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

Postgres array type generates SQL syntax error for insert with useLiterals turned on #2401

Closed
tajhlande opened this issue Jan 4, 2019 · 1 comment
Labels

Comments

@tajhlande
Copy link

I am using QueryDSL 4.2.1, Postgres 10.5, Java 8.

when executing a SQLInsertClause with setUseLiterals(true), I get a stack trace like this:

com.querydsl.core.QueryException: Caught PSQLException for insert into ddd_it.data_table (data_store_name, primary_key_def, schema_name, table_name)
values ('mydsname', [Ljava.lang.String;@2dc54ad4, 'myschema', 'mytable')
	at com.querydsl.sql.DefaultSQLExceptionTranslator.translate(DefaultSQLExceptionTranslator.java:50)
	at com.querydsl.sql.Configuration.translate(Configuration.java:508)
	at com.querydsl.sql.dml.AbstractSQLInsertClause.execute(AbstractSQLInsertClause.java:436)
	at us.catalist.ddd.service.live.LiveDictionaryMaintenanceService.executeModifications(LiveDictionaryMaintenanceService.java:112)
	... 25 more
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "["
  Position: 120

Here is my table definition:

CREATE TABLE data_table (
    data_store_name TEXT,
    schema_name TEXT,
    table_name TEXT,
    primary_key_def TEXT[],
    relation_type TEXT,
    PRIMARY KEY (data_store_name, schema_name, table_name),
    FOREIGN KEY (data_store_name, schema_name) REFERENCES
            data_schema (data_store_name, schema_name)
);

Although this works when setUseLiterals(true) is not invoked, it is harder to debug my application because I cannot see what values are bound to the callable statement parameters in the logging. It seems like i could do this through some elaborate code in a SQLListener implementation, but then I am inferring what happened in SQL from elements rather than looking directly at the bound values.

Is there some other way to confirm the bound values on the callable statement that is executed?

@stale
Copy link

stale bot commented Jun 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 3, 2021
@stale stale bot closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant