On 18 October 2011 09:57, wrote:
> Hi,
>
> Thanks for the reply!
> But I don't want to check if the table exists, I want to see the
> result of the SELECT query, if a row presence or not.
So you want to check that the table contains data? In that case it
makes no sense to create the table if it
Hi,
Thanks for the reply!
But I don't want to check if the table exists, I want to see the
result of the SELECT query, if a row presence or not.
The tmp_tbl is a dynamic generated table name, but when I write the
code without EXECUTE, I get syntax error too.
In this case how can I check if a SELEC
On Mon, Oct 17, 2011 at 10:28 AM, Alban Hertroys wrote:
> On 17 October 2011 16:24, Merlin Moncure wrote:
>> On Mon, Oct 17, 2011 at 8:44 AM, Alban Hertroys wrote:
>>> On 17 October 2011 15:20, Merlin Moncure wrote:
A better way to do this is to query information_schema:
PERFORM
On 17 October 2011 16:24, Merlin Moncure wrote:
> On Mon, Oct 17, 2011 at 8:44 AM, Alban Hertroys wrote:
>> On 17 October 2011 15:20, Merlin Moncure wrote:
>>> A better way to do this is to query information_schema:
>>>
>>> PERFORM 1 FROM information_schema.tables where schema_name = x and
>>> t
On Mon, Oct 17, 2011 at 8:44 AM, Alban Hertroys wrote:
> On 17 October 2011 15:20, Merlin Moncure wrote:
>> A better way to do this is to query information_schema:
>>
>> PERFORM 1 FROM information_schema.tables where schema_name = x and
>> table_name = y;
>>
>> IF FOUND THEN
>> CREATE TABLE ...
On 17 October 2011 15:20, Merlin Moncure wrote:
> A better way to do this is to query information_schema:
>
> PERFORM 1 FROM information_schema.tables where schema_name = x and
> table_name = y;
>
> IF FOUND THEN
> CREATE TABLE ...
> END IF;
>
> (there is a race condition in the above code -- do
On Mon, Oct 17, 2011 at 8:20 AM, Merlin Moncure wrote:
> On Mon, Oct 17, 2011 at 2:32 AM, wrote:
>> Hi there,
>>
>> I would like to use EXISTS in a small plpgsql function but I always
>> get a "syntax error". How can I execute a query inside the
>> EXISTS function?
>>
>>
>>
>> IF NOT EXISTS(EXEC
On Mon, Oct 17, 2011 at 2:32 AM, wrote:
> Hi there,
>
> I would like to use EXISTS in a small plpgsql function but I always
> get a "syntax error". How can I execute a query inside the
> EXISTS function?
>
>
>
> IF NOT EXISTS(EXECUTE 'SELECT * FROM '|| tmp_tbl)
> THEN
> CREATE TABLE tt();
Hi there,
I would like to use EXISTS in a small plpgsql function but I always
get a "syntax error". How can I execute a query inside the
EXISTS function?
IF NOT EXISTS(EXECUTE 'SELECT * FROM '|| tmp_tbl)
THEN
CREATE TABLE tt();
ERROR: syntax error at or near "EXECUTE"
LINE 1: SELE