Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: pgjdbc PgResultSetMetaData.fetchFieldMetaData fails with unsupported comparison operator: <oid> = <int> #53143

Closed
rafiss opened this issue Aug 20, 2020 · 0 comments · Fixed by #53523
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change.

Comments

@rafiss
Copy link
Collaborator

rafiss commented Aug 20, 2020

Here is an example query generated by that PGJDBC function:

SELECT
  c.oid,
  a.attnum,
  a.attname,
  c.relname,
  n.nspname,
  a.attnotnull
  OR (t.typtype = 'd' AND t.typnotnull),
  pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%'
FROM
  pg_catalog.pg_class AS c
  JOIN pg_catalog.pg_namespace AS n ON (c.relnamespace = n.oid)
  JOIN pg_catalog.pg_attribute AS a ON (c.oid = a.attrelid)
  JOIN pg_catalog.pg_type AS t ON (a.atttypid = t.oid)
  LEFT JOIN pg_catalog.pg_attrdef AS d ON
      (d.adrelid = a.attrelid AND d.adnum = a.attnum)
  JOIN (SELECT 1 AS oid, 1 AS attnum) AS vals ON
      (c.oid = vals.oid AND a.attnum = vals.attnum);

A test that reproduces this is in pgjdbc's UpdateableResultTest.

The error stack trace is

org.postgresql.util.PSQLException: ERROR: unsupported comparison operator: <oid> = <int>
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2578)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2313)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:331)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:310)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:296)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:273)
	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:226)
	at org.postgresql.jdbc.PgResultSetMetaData.fetchFieldMetaData(PgResultSetMetaData.java:247)
	at org.postgresql.jdbc.PgResultSetMetaData.getBaseColumnName(PgResultSetMetaData.java:154)
	at org.postgresql.jdbc.PgResultSet.updateValue(PgResultSet.java:3099)
	at org.postgresql.jdbc.PgResultSet.updateInt(PgResultSet.java:1229)
	at org.postgresql.test.jdbc2.UpdateableResultTest.testCancelRowUpdates(UpdateableResultTest.java:104)
@rafiss rafiss added C-investigation Further steps needed to qualify. C-label will change. A-sql-pgcompat Semantic compatibility with PostgreSQL labels Aug 20, 2020
@rafiss rafiss self-assigned this Aug 26, 2020
@craig craig bot closed this as completed in 1f1ac2e Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant