-
-
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 bug "UNION types \"char\" and text cannot be matched" with v9.0.1.+++ versions #2413
Conversation
I don't have a pg 15 to test it, but LGTM! Could you add an entry to the Fixed section in the CHANGELOG? |
Done! |
I think this is part of a bigger issue: PG15 support. It makes little sense to me to commit something as isolated as this now. We need to ensure this doesn't break again and that we don't have any other problems with PG15. So we should add PG15 to our postgres versions in nix. I don't think this version is currently in the nixpkgs, so we'd need to figure out how to install it. But I guess we should do that once, and then we can always use the latest beta version ahead of time to confirm everything still works. |
Looks like pg14 was added as beta1 already to nixpkgs last year: NixOS/nixpkgs@285fa46 So maybe we just need somebody to put up a PR for pg15 beta 2? |
That somebody was me, I guess: NixOS/nixpkgs#185751 |
I haven't checked if this is working with previous versions of postgres. But it seems that it should also fail because this union is wrong anyway in any postgres version. Is it possible that the column contype was added just after stable 9.0.1? 9.0.1 is working nicely with postgres 15 beta 2. |
Right, that makes sense. Can you test this with pg14, too? If that fails as well, we need to find out what you have in your schema that triggers this, because we certainly want to test this to avoid a regression.
No, not really. The same construct was there before, but it was moved around to a different query since. |
I will test this with postgres 14 |
Scratch that, I confused this with something else. The |
I'm pretty sure this issue came up after the change discussed here https://www.postgresql.org/message-id/flat/2216388.1638480141%40sss.pgh.pa.us So this should really be a pg15 issue only. |
You are right then, postgres 15 seems to not consider char as text anymore as it is deprecated and this should not affect past versions of postgres. Anyway it is working fine until postgREST 9.0.1 stable so this is due to recent changes only. Do I have a way to build a docker image locally to try this out? It was trying to find a dockerfile, but it seems that you use Nix. I don't know anything about nix but it should be pretty the same? |
Could you build a docker image with this change so I can try this with postgres 15? |
Seeing that NixOS/nixpkgs#185751 is blocked, I think we should just merge here. I've added a note here for testing pg15 when it's available. |
I've |
Suggested syntax change done! Also modified the column alias syntax "as contype" as it seems that this is always used for column alias. |
Confirm is working nicely version v10.0.0! |
Hi, i have similar problem on pg:latest (15) tag (docker) |
Upgrade postgrest to at least v10.0.0, this is not happening anymore, already solved. |
The query in:
postgrest/src/PostgREST/DbStructure.hs
Lines 655 to 809 in bac63f3
Doesn't properly consider the type of the column contype (char) of the table pg_constraint. So when it tries to make a union with the concat function (text), fails with a missmatch type error. This fixes the issue.
Related issue here:
Reported issue
#2410