Skip to content

Conversation

@jeromedoucet
Copy link

what:
Add named parameters support for "conn". It works basically like ordinals
parameters, but with an alphabetical label prefixed with ":"

Example:

Select $1, $2, $1; may become Select :firstName, :lastName, :firstName

Why:
SQL queries may be difficult to maintain, especially when the complexity
is growing. Ordinal parameters are great, but may not be meaningfull for
the one who is trying to understand the query.

The goal here is not to have something full featured and complex : pq is
"just" a driver, but having a thin layer, simple to maintain, that will
fit 90% of the needs.

Limitations:
Its simplicity means that there is many limitations :

First of all, using mixed types of parameters is not
allowed. Man can not use ordinal parameters and named
parameters is the same query.

Refs #534

what:
Add named parameters support for "conn". It works basically like ordinals
parameters, but with an alphabetical label prefixed with ":"

Example:

Select $1, $2, $1; may become Select :firstName, :lastName, :firstName

Why:
SQL queries may be difficult to maintain, especially when the complexity
is growing. Ordinal parameters are great, but may not be meaningfull for
the one who is trying to understand the query.

The goal here is not to have something full featured and complex : pq is
"just" a driver, but having a thin layer, simple to maintain, that will
fit 90% of the needs.

Limitations:
Its simplicity means that there is many limitations :

First of all, using mixed types of parameters is not
allowed. Man can not use ordinal parameters and named
parameters is the same query.

Refs lib#534
Add explicit cast for some postgres version.

Refs lib#534
@Congee
Copy link

Congee commented Jun 4, 2020

any blocker?

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.

2 participants