Re: check_function_bodies not doing much - Mailing list pgsql-general

From Pavel Stehule
Subject Re: check_function_bodies not doing much
Date
Msg-id CAFj8pRAuO_dVj57PuwBJ5oFkD7AnwTM=Fg_siobSXMjnBzLmPw@mail.gmail.com
Whole thread Raw
In response to check_function_bodies not doing much  (Marcelo Lacerda <marceloslacerda@gmail.com>)
List pgsql-general
Hi

2018-08-07 21:17 GMT+02:00 Marcelo Lacerda <marceloslacerda@gmail.com>:
I was trying to get postgres to warn me that I'm referencing a table that it doesn't exists inside a function so I was told on the IRC to check the setting "check_function_bodies", however when I use it in a plpgsql function it doesn't actually check if the tables in the body exist. Is this the correct behavior?

Example:
http://paste.debian.net/1037080/

It is expected behave. PL/pgSQL checks immediately only syntax of embedded SQL. With this design plpgsql functions are not too sensitive on objects' dependency. You can use reference on temporary tables what usually doesn't exists in plpgsql validation time.

For deeper check you can use plpgsql_check https://github.com/okbob/plpgsql_check

It does almost all possible static checks.

Regards

Pavel

pgsql-general by date:

Previous
From: Marcelo Lacerda
Date:
Subject: check_function_bodies not doing much
Next
From: Tom Lane
Date:
Subject: Re: check_function_bodies not doing much