(Newbie-ish) pgSqlCommand seems to be case insensitive
Posted: Wed 19 May 2010 09:51
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
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