Hi
2018-08-07 21:17 GMT+02:00 Marcelo Lacerda <marceloslacerda@xxxxxxxxx>:
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