Skip to content

Keep PostgreSQL casts attached to named parameters - #1002

Open
official-burak wants to merge 1 commit into
jmoiron:masterfrom
official-burak:fix/named-postgres-cast
Open

Keep PostgreSQL casts attached to named parameters#1002
official-burak wants to merge 1 commit into
jmoiron:masterfrom
official-burak:fix/named-postgres-cast

Conversation

@official-burak

Copy link
Copy Markdown

compileNamedQuery started a named parameter at :boundary and then treated the first colon of a following PostgreSQL cast as an unexpected : inside that name, so queries like :boundary::jsonb never compiled.

After a completed name, :: is now kept as a type cast (?::jsonb, $1::jsonb, @p1::jsonb). The existing :: escape (a doubled colon that is not attached to a name, including :=) is unchanged. A lone extra colon inside a name (:first:name) still errors.

Fixes #983

compileNamedQuery treated the first colon of :name::type as an error
while still inside the name, so sqlx.Named(":boundary::jsonb") failed
before any bind vars were produced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlx.Named fails when a named parameter is immediately followed by a PostgreSQL cast

1 participant