From: | PetSerAl <petseral(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Record returning function accept not matched columns declaration |
Date: | 2024-02-29 18:15:56 |
Message-ID: | CAKygsHSerA1eXsJHR9wft3Gn3wfHQ5RfP8XHBzF70_qcrrRvEg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
postgres=# SHOW SERVER_VERSION;
server_version
----------------
16.2
(1 row)
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, coalesce(b) as c(d int,e int, f int)
postgres-# union all
postgres-# select * from a, nullif(b, null) as c(d int,e int, f int)
postgres-# union all
postgres-# select * from a, unnest(array[b]) as c(d int,e int, f int)
postgres-# union all
postgres-# select * from a, json_populate_record(b, null) as c(d int,e
int, f int); --expect OK
b | d | e | f
---------+---+---+---
(1,2,3) | 1 | 2 | 3
(1,2,3) | 1 | 2 | 3
(1,2,3) | 1 | 2 | 3
(1,2,3) | 1 | 2 | 3
(4 rows)
postgres=#
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, coalesce(b) as c(d int,e int)
postgres-# union all
postgres-# select * from a, nullif(b, null) as c(d int,e int); --expect Error
ERROR: function return row and query-specified return row do not match
DETAIL: Returned row contains 3 attributes, but query expects 2.
postgres=#
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, unnest(array[b]) as c(d int,e int); --expect Error
ERROR: function return row and query-specified return row do not match
DETAIL: Returned row contains 3 attributes, but query expects 2.
postgres=#
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, json_populate_record(b, null) as c(d int,e
int); --expect Error
ERROR: function return row and query-specified return row do not match
DETAIL: Returned row contains 3 attributes, but query expects 2.
postgres=#
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, coalesce(b) as c(d int,e int); --expect Error
b | d | e
---------+---+---
(1,2,3) | 1 | 2
(1 row)
postgres=#
postgres=# with a(b) as (values (row(1,2,3)))
postgres-# select * from a, nullif(b, null) as c(d int,e int); --expect Error
b | d | e
---------+---+---
(1,2,3) | 1 | 2
(1 row)
postgres=#
Expect last two commands to fail with the same error.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2024-02-29 19:48:13 | Re: Record returning function accept not matched columns declaration |
Previous Message | ocean_li_996 | 2024-02-29 16:44:29 | Re:Re: BUG #18369: logical decoding core on AssertTXNLsnOrder() |