Re: How to know if a query is semantically correct without execute it?

From: CR Lender <crlender(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to know if a query is semantically correct without execute it?
Date: 2013-09-19 01:20:03
Message-ID: 523A5143.6010105@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2013-09-19 02:01, Juan Daniel Santana Rodes wrote:
> I am programming a procedure in plpgsql language and it must return a
> boolean response. The procedure must return TRUE if the query is
> semantically correct and if not correct, return FALSE. This must be
> done without running the query.

You could use EXPLAIN instead of running the actual query, catching the
eventual errors and returning TRUE or FALSE depending on the outcome.
I'm not sure what you mean by "semantically correct", but in addition to
simple syntax errors, non-existent relations, columns, functions, etc,
would also be caught.

regards,
CRL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan 2013-09-19 03:18:12 Re: Query - CPU issue
Previous Message Juan Daniel Santana Rodes 2013-09-19 00:01:31 How to know if a query is semantically correct without execute it?