postgrest icon indicating copy to clipboard operation
postgrest copied to clipboard

Bug "UNION types \"char\" and text cannot be matched" with v9.0.1.+++ versions,

Open yevon opened this issue 3 years ago • 6 comments

Environment

  • PostgREST docker image version: v9.0.1.20220802 or v9.0.1.20220714

Description of issue

I was trying versions above v9.0.1, from v9.0.1.20220714, but when I change the docker image I just receive errors in the docker logs. Any idea what could it be? If I just go back to the stable v9.0.1 it works ok. I tried a schema reload without success.

image

yevon avatar Aug 08 '22 20:08 yevon

Which PostgreSQL version are you using?

Can you try to put together a reproducible example? There's probably something in your schema that triggers this.

wolfgangwalther avatar Aug 08 '22 20:08 wolfgangwalther

You could also have a look at the PostgreSQL logs - the statement that failed should be logged there, could you show us that, too?

wolfgangwalther avatar Aug 08 '22 20:08 wolfgangwalther

I'm using the postgres 15 beta 2. I think that I found the query that fails, if I try to manually execute it it fails:

Found here:

https://github.com/PostgREST/postgrest/blob/bac63f339daa4a9292870b0674b41cde2bcfee74/src/PostgREST/DbStructure.hs#L655-L809

I'm trying to figure out why:

image

yevon avatar Aug 08 '22 21:08 yevon

The issue is here, but I don't quite understand why it fails, it is mixing char and text:

image

yevon avatar Aug 08 '22 21:08 yevon

Possible fix is to add a cast to the first union:

image

yevon avatar Aug 08 '22 22:08 yevon

Seems to be just that, contype is type "char" and concat returns type "text", so the union fails:

image

yevon avatar Aug 08 '22 22:08 yevon

Clossing this as this was corrected in v10.0.0! Thanks.

yevon avatar Aug 23 '22 19:08 yevon