Skip to content

using an EnumCodec with no enums generates invalid SQL #515

New issue

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

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

Already on GitHub? # to your account

Closed
osi opened this issue May 23, 2022 · 2 comments
Closed

using an EnumCodec with no enums generates invalid SQL #515

osi opened this issue May 23, 2022 · 2 comments
Labels
type: bug A general bug

Comments

@osi
Copy link

osi commented May 23, 2022

Bug Report

Versions

  • Driver: 0.9.0.RELEASE
  • Database: PostgreSQL 12.10 (Debian 12.10-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
  • Java:
  • OS:

Current Behavior

Create a CodecRegistrar but put nothing in it,

EnumCodec.builder().build()

This generates the following invalid SQL statement

22-05-23 18:56:23.127 UTC [20203] STATEMENT:  SELECT pg_type.oid, typarray, typname, typcategory   FROM pg_catalog.pg_type   LEFT   JOIN (select ns.oid as nspoid, ns.nspname, r.r           from pg_namespace as ns           join ( select s.r, (current_schemas(false))[s.r] as nspname                    from generate_series(1, array_upper(current_schemas(false), 1)) as s(r) ) as r          using ( nspname )        ) as sp     ON sp.nspoid = typnamespace  WHERE typname IN ()  ORDER BY sp.r, pg_type.oid DESC ;
2022-05-23 18:56:23.127 UTC [20202] ERROR:  syntax error at or near ")" at character 429

Expected behavior/code

The CodecRegistar returned from io.r2dbc.postgresql.codec.EnumCodec.Builder#build should do nothing if no enums have been registered

@osi osi added the status: waiting-for-triage An issue we've not yet triaged label May 23, 2022
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 24, 2022
@mp911de mp911de added this to the 0.8.13.RELEASE milestone May 24, 2022
mp911de added a commit that referenced this issue May 24, 2022
Also, improve PostgresTypes safety if the collection of type names is empty.

[resolves #515]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
mp911de added a commit that referenced this issue May 24, 2022
Also, improve PostgresTypes safety if the collection of type names is empty.

[resolves #515]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
@mp911de
Copy link
Collaborator

mp911de commented May 24, 2022

Thanks for the report. That's fixed now.

@osi
Copy link
Author

osi commented May 24, 2022

thank you for the quick turnaround!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants