I am writing an applet to restore data to a db using pgSqlDump.
I am presuming that the restore method will not overwrite the tables or clear them down before restoring (at least not read anyhing to let me do that yet) so I though a simple drop db and recreate will do the job.
The code in use is:
Devart.Data.PostgreSql.PgSqlCommand command1 = new Devart.Data.PostgreSql.PgSqlCommand
("DROP DATABASE IF EXISTS " + dbName + ";", myConnection.getConnection());
Devart.Data.PostgreSql.PgSqlCommand command2 = new Devart.Data.PostgreSql.PgSqlCommand
("CREATE DATABASE " + dbName + " ENCODING 'WIN1252' TEMPLATE template0;", myConnection.getConnection());
try
{
command1.ExecuteNonQuery();
}
catch (Exception ex) { MessageBox.Show(ex.Message); };
try
{
command2.ExecuteNonQuery();
}
catch (Exception ex) { MessageBox.Show(ex.Message); };
dbName has the value NewTest
No errors the code. The code does execute BUT. My Db NewTest remains in the schema but a database newtest is created i.e. it ignores the case of the characters in the name of the db.
Is this a postgres issue or a devart issue?
Thank you
(Newbie-ish) pgSqlCommand seems to be case insensitive
-
- Posts: 52
- Joined: Tue 05 Jan 2010 12:26
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
By default, PostgreSQL servers are case-insensitive. To use case-sensitive string constants, please quote them:
Code: Select all
CREATE DATABASE "NewTest";
-
- Posts: 52
- Joined: Tue 05 Jan 2010 12:26