Re: Setting up functions in psql.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Setting up functions in psql.
Дата
Msg-id 9077.1171601565@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Setting up functions in psql.  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Ответы Re: Setting up functions in psql.  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Список pgsql-general
Paul Lambert <paul.lambert@autoledgers.com.au> writes:
> What I am confused about is: Why does the creation of a function fail if
> a table it uses does not exist when the function itself is creating the
> table further up to where it references it?

Because the function isn't actually being *executed*, only
syntax-checked.

The syntax precheck isn't completely reliable, for this reason among
others, so you can turn it off via check_function_bodies = off.

However, I'm not sure but what the function would fail anyway at runtime
for the same reason.  I think in a SQL function, it all gets parsed
before any is executed.  (This could probably get fixed, if we thought
it was worth the trouble.)

> Secondly, and here's the obviously easy one that I'm having a mental
> blank trying to figure out... How would I execute a function (such as
> the above) from psql?

select "fnLoadAppraisals"();

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: requests / suggestions to help with backups
Следующее
От: Paul Lambert
Дата:
Сообщение: Re: Setting up functions in psql.