-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix: paramaters of type character and bit not ignoring length #2867
Conversation
According to PostgreSQL docs on character types:
But, the docs for CREATE FUNCTION say this:
It made me think that I couldn't find in the source code how they handle this change, so I casted both |
If they fail when exceeding the length I guess it's fine. (maybe the error message changes but it wouldnt be a dealbreaker) |
, ppType :: Text | ||
, ppTypeMaxLength :: Text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ppType
now unused? Would it make sense to have a single ppType
with the added length for these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, ppType
is still used on every other place (e.g. errors, OpenAPI, etc.) Only when building the Query it transforms e.g. character
-> character varying
.
The thing is, the length is ignored by PostgreSQL, it's not specified in the function definition, so no length can be added, it's the character
-> character varying
change that's done here.
To clarify a little more, this change could also be done using only ppType
. It wouldn't be at Schema Cache level, but per request instead, e.g.
case ppType of
"character" -> "character varying"
"bit" -> "bit varying"
...
bfe6d5d
to
cf829c3
Compare
Interestingly, only the PG14 io-test keeps failing. Could not find a reason why for now. Maybe a change needs to be done in the schema query. |
@laurenceisla I don't see the pg 14 failure from CI. Can you link to the error? |
cf829c3
to
fc54b9e
Compare
@steve-chavez Ah, true. Strangely it failed twice in a row (1st and 2nd attempt) https://github.com/PostgREST/postgrest/actions/runs/5661060491/attempts/2?pr=2867, then the last ones run without problems. |
Closes #1586.