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

Type "int[]" does not exist when using dynamic values for casting #3365

Open
aemonm opened this issue Jan 30, 2025 · 1 comment
Open

Type "int[]" does not exist when using dynamic values for casting #3365

aemonm opened this issue Jan 30, 2025 · 1 comment

Comments

@aemonm
Copy link

aemonm commented Jan 30, 2025

I have the following statement to as part of a larger query:
sql`AND my_table.some_column = ANY(${values}::${pgSql(type)}[])`

When type is text, it works as expected. When type is int I get the following error:
Error [PostgresError]: type "int[]" does not exist

Shouldn't I be able to use dynamic type casting for both text and int ?

@charmander
Copy link
Collaborator

Yes, that should work. It’s probably an entirely PostgreSQL-side issue, though, and not something introduced by this client.

  • Are you able to reproduce the issue with a different client, e.g. psql?
  • Which PostgreSQL server version (or PostgreSQL-compatible alternative database) are you using?
  • Do casts to integer[] work? How about just int?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants