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  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: ocean_li_996
Дата:
Сообщение: Re:Re: BUG #18369: logical decoding core on AssertTXNLsnOrder()
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Record returning function accept not matched columns declaration