The following statements work fine in 7.4

 

                                    Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/psdb","xxx","");

                                    Statement stmt = conn.createStatement();

                                    stmt.execute("CREATE TABLE \"public\".tt (ans bool)");

                                    stmt.close();

 

                                    stmt = conn.createStatement();

                                    ResultSet rs = stmt.executeQuery("SELECT \"psdb \".\"public\".\"tt\".\"ans\" FROM \"psdb \".\"public\".\"tt\"");

                                    while (rs.next()) {

                                                System.out.println(rs.getBoolean(1));

                                    }

                                    rs.close();

 

 

But in 8.0 Beta4 we get the following exception at the SELECT executeQuery line:

 

java.sql.SQLException: ERROR: syntax error at end of input

      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1187)

      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:990)

      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:138)

      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:347)

      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:279)

      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:191)

      at BoolTest.main(BoolTest.java:30)

 

 

OS = Windows XP Pro

Java version 1.5.0-b64

JDBC driver: pgdev.307.jdbc3.jar

 

This seems to be related to having the catalog qualifier.  There is no problem when just the schema is included. i.e.

            ResultSet rs = stmt.executeQuery("SELECT \"public\".\"tt\".\"ans\" FROM \"public\".\"tt\"");

works OK.

 

Also, there is no problem with UPDATE or INSERT statements when the catalog is included.  Only in the SELECT statement.

 

I did note that the driver does return false to connection.getMetaData().supportsCatalogsInDataManipulation(), so, there is actually no reason to expect that catalog qualifiers would be supported. However, as noted, it did work OK in 7.4 (even though the supportsCatalogsInDataManipulation() returned false there also).

 

Same type of error is returned just running fully qualified SQL statements in the Query Tool in pgAdmin.

 

Thanks.

 

-al laferriere

Reply via email to