Index: src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v retrieving revision 1.18 diff -c -r1.18 DatabaseMetaDataTest.java *** src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java 29 May 2003 04:39:48 -0000 1.18 --- src/interfaces/jdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java 3 Nov 2003 10:20:15 -0000 *************** *** 137,142 **** --- 137,174 ---- fail(ex.getMessage()); } } + + public void testForeignKeyActions() + { + try { + Connection conn = TestUtil.openDB(); + TestUtil.createTable(conn, "pkt", "id int primary key"); + TestUtil.createTable(conn, "fkt1", "id int references pkt on update restrict on delete cascade"); + TestUtil.createTable(conn, "fkt2", "id int references pkt on update set null on delete set default"); + DatabaseMetaData dbmd = conn.getMetaData(); + + ResultSet rs = dbmd.getImportedKeys(null,"","fkt1"); + assertTrue(rs.next()); + assertTrue(rs.getInt("UPDATE_RULE") == DatabaseMetaData.importedKeyRestrict); + assertTrue(rs.getInt("DELETE_RULE") == DatabaseMetaData.importedKeyCascade); + rs.close(); + + rs = dbmd.getImportedKeys(null,"","fkt2"); + assertTrue(rs.next()); + assertTrue(rs.getInt("UPDATE_RULE") == DatabaseMetaData.importedKeySetNull); + assertTrue(rs.getInt("DELETE_RULE") == DatabaseMetaData.importedKeySetDefault); + rs.close(); + + TestUtil.dropTable(conn,"fkt2"); + TestUtil.dropTable(conn,"fkt1"); + TestUtil.dropTable(conn,"pkt"); + } + catch (SQLException ex) + { + fail(ex.getMessage()); + } + } + public void testForeignKeys() { try