Re: Why does the PL/pgSQL compiler do this?

Поиск
Список
Период
Сортировка
От Michael Moore
Тема Re: Why does the PL/pgSQL compiler do this?
Дата
Msg-id CACpWLjMWR16qikWpzu8GVoboJCg7s_p-9BM+85Lh2WP+ocB=og@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why does the PL/pgSQL compiler do this?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Why does the PL/pgSQL compiler do this?
Список pgsql-sql
Hi Tom, 
understood. If anybody needs a tiny bit of motivation to write that extra bit of code which would complain at compile time: I sense that there are a lot of shops like mine who would love to get off of Oracle due to the cost. That means you'll have guys like myself who are well versed on Oracle's PL/SQL trying to write PL/pgSQL functions. If ROLLBACK; were to cause a syntax error, it would immediately tell guys like myself that we are missing a key concept of how PL/pgSQL works. Saving the error until run time makes look for other reasons that ROLLBACK; might not be working.  I know it's a trivial point, but just putting it out there.

Thanks everybody for the enlightening conversation!

Regards,
Mike


On Mon, Oct 31, 2016 at 7:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Michael Moore <michaeljmoore@gmail.com> writes:
> I'm still a bit confused. If I replace the ROLLBACK; command with ELEPHANT;
> the result is a syntax error. Why doesn't ROLLBACK; produce the same error
> since it is not valid in the LANGUAGE plpgsql.

That's a runtime error so far as plpgsql is concerned, because it relies
on the SPI layer to throw the error.  It might be practical to complain
about it at compile time, but it would be some extra code that nobody's
written.

                        regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why does the PL/pgSQL compiler do this?
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Why does the PL/pgSQL compiler do this?