Re: Strange behavior with missing column in SQL function

Поиск
Список
Период
Сортировка
От Marcelo Lacerda
Тема Re: Strange behavior with missing column in SQL function
Дата
Msg-id CAPmRTtOL3mNGf-0MwwAWJjmc=WJo0Y7QDc0R2AOhSkPQ=i_KEg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Strange behavior with missing column in SQL function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> CREATE OR REPLACE FUNCTION myfunction(myrow mytable)
> RETURNS INTEGER AS $$
>     SELECT myrow.c + myrow.b FROM myrow;
> $$ LANGUAGE sql;

> where "myrow" is a table with a different set of column names from
> "mytable".  The existing behavior for that is to seek the column name
> in "myrow" (the table), failing that to seek it in the parameter,
> and only to throw an error if both fail.
Wow I never thought this would be possible. why didn't the designers of the language use myrow mytable%ROWTYPE for rows of a table as a parameter, given that it's a valid type in PL/PGSQL? I figure that way it would have been way easier to disambiguate the definitions.

В списке pgsql-general по дате отправления:

Предыдущее
От: Johnes Castro
Дата:
Сообщение: Re: pg_basebackup without copying the logs
Следующее
От: Ertan Küçükoğlu
Дата:
Сообщение: How to prevent "no wait lock" after a connection drop