Re: How to evaluate if a query is correct?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Rob Sargentg <robjsargent(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to evaluate if a query is correct?
Date: 2013-09-19 15:05:31
Message-ID: CAFj8pRDJG9iaZdE9wV48Bqa+wN0o3TAN4wGD4UqxKDk7B82Wyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

you can use a PREPARE statement.

Pavel

2013/9/19 Rob Sargentg <robjsargent(at)gmail(dot)com>

> 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<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
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-09-19 15:07:08 Re: How to evaluate if a query is correct?
Previous Message Rob Sargentg 2013-09-19 15:02:28 Re: How to evaluate if a query is correct?