Record returning function accept not matched columns declaration
От | PetSerAl |
---|---|
Тема | Record returning function accept not matched columns declaration |
Дата | |
Msg-id | CAKygsHSerA1eXsJHR9wft3Gn3wfHQ5RfP8XHBzF70_qcrrRvEg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Record returning function accept not matched columns declaration
|
Список | 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.
В списке pgsql-bugs по дате отправления: