Re: How to evaluate if a query is correct? - Mailing list pgsql-general

From Rob Sargentg
Subject Re: How to evaluate if a query is correct?
Date
Msg-id 523B1204.3020700@gmail.com
Whole thread Raw
In response to How to evaluate if a query is correct?  (Juan Daniel Santana Rodés<jdsantana@estudiantes.uci.cu>)
Responses Re: How to evaluate if a query is correct?  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: How to evaluate if a query is correct?  (David Johnston <polobo@yahoo.com>)
List pgsql-general
On 09/19/2013 12:13 AM, Juan Daniel Santana Rodés wrote:
> Hi my friends...
> I wrote in the last post a question similiar to this. But in this post
> I clarify better the previous question.
> I need know how to evaluated if a query is correct without execute it.
> When I say if a query is correct, is that if I run the query, it did
> not throw an exception.
> For example...
>
> create or replace function is_correct(query text) returns boolean as
> $body$
>  Declare
>  Begin
>   -- Here I check if the query is correct, but I can't execute this
> query, because it may make changes in the data base
>  End;
> $body$
> language 'plpgsql';
>
> Greetings
> __________________________________________________
> "Todos el 12 de Septiembre con una Cinta Amarilla"
> FIN A LA INJUSTICIA, LIBERENLOS YA!!
> http://www.antiterroristas.cu http://justiciaparaloscinco.wordpress.com
>
>
Is this an academic exercise or are you actually planning on checking
sql then executing it if it's ok (according to your function).  I love
plpgsql but I don't think it's the best option for, just to get started,
parsing the incoming sql text - that would be one nasty regexp :)

rjs



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: reading cvs logs with pgadmin queries
Next
From: Pavel Stehule
Date:
Subject: Re: How to evaluate if a query is correct?