Revision: 5155 http://sourceforge.net/p/jump-pilot/code/5155 Author: michaudm Date: 2016-11-05 12:07:05 +0000 (Sat, 05 Nov 2016) Log Message: ----------- Fix regression with schema handling in old save to postgis plugin
Modified Paths: -------------- core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISDataSource.java Modified: core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISDataSource.java =================================================================== --- core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISDataSource.java 2016-11-05 11:49:54 UTC (rev 5154) +++ core/trunk/src/org/openjump/core/ui/plugin/datastore/postgis/SaveToPostGISDataSource.java 2016-11-05 12:07:05 UTC (rev 5155) @@ -386,11 +386,20 @@ private void addDBPrimaryKey(SpatialDatabasesDSConnection conn, String dbSchema, String dbTable, String primaryKey) throws SQLException { String tableFullName = SQLUtil.compose(dbSchema, dbTable); - String sql_test_seq = "SELECT * FROM information_schema.sequences\n" + - " WHERE sequence_schema = '" + dbSchema + "' AND sequence_name = 'openjump_dbid_sequence';"; - String sql_create_seq = "CREATE SEQUENCE \"" + dbSchema + "\".openjump_dbid_sequence;"; - String sql_create_dbid = "ALTER TABLE " + tableFullName + " ADD COLUMN \"" + - primaryKey + "\" BIGINT DEFAULT nextval('\"" + dbSchema + "\".openjump_dbid_sequence') PRIMARY KEY;"; + String sql_test_seq, sql_create_seq, sql_create_dbid; + if (dbSchema == null) { + sql_test_seq = "SELECT * FROM information_schema.sequences\n" + + " WHERE sequence_name = 'openjump_dbid_sequence';"; + sql_create_seq = "CREATE SEQUENCE openjump_dbid_sequence;"; + sql_create_dbid = "ALTER TABLE " + tableFullName + " ADD COLUMN \"" + + primaryKey + "\" BIGINT DEFAULT nextval('openjump_dbid_sequence') PRIMARY KEY;"; + } else { + sql_test_seq = "SELECT * FROM information_schema.sequences\n" + + " WHERE sequence_schema = '" + dbSchema + "' AND sequence_name = 'openjump_dbid_sequence';"; + sql_create_seq = "CREATE SEQUENCE \"" + dbSchema + "\".openjump_dbid_sequence;"; + sql_create_dbid = "ALTER TABLE " + tableFullName + " ADD COLUMN \"" + + primaryKey + "\" BIGINT DEFAULT nextval('\"" + dbSchema + "\".openjump_dbid_sequence') PRIMARY KEY;"; + } boolean sequence_already_exists; // check if openjump_dbid_sequence already exists try { ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel