Re: check_function_bodies not doing much

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marcelo Lacerda <marceloslacerda(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: check_function_bodies not doing much
Date: 2018-08-07 19:25:30
Message-ID: CAFj8pRAuO_dVj57PuwBJ5oFkD7AnwTM=Fg_siobSXMjnBzLmPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

2018-08-07 21:17 GMT+02:00 Marcelo Lacerda <marceloslacerda(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-08-07 19:31:30 Re: check_function_bodies not doing much
Previous Message Marcelo Lacerda 2018-08-07 19:17:18 check_function_bodies not doing much