CLOSURE: EXECUTE of a 'create table' string is not happening

From: Ralph Smith <rsmith(at)10kinfo(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: CLOSURE: EXECUTE of a 'create table' string is not happening
Date: 2011-02-22 20:11:03
Message-ID: 4D641857.607@10kinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This worked!!!
FOR TableRec IN EXECUTE ExecuteString LOOP

THANKS ALL!!!
Ralph

p.s. The reason we're still using 7.4 is that some system logs were
trashed and we NEED that data. All but the BLOGS have been recovered,
and there lies the problem.
=====================================

Pavel Stehule wrote:
> 2011/2/22 Ralph Smith <rsmith(at)10kinfo(dot)com>:
>
>> Hi,
>>
>> I'm passing a tablename and two columnnames into a function so that I can
>> SELECT Records in a FOR LOOP using 'fixed' field names.
>> Using the passed params I construct the create table command and then alter
>> the names of two columns.
>>
>> When I 'build' the function and then run my query to use the function w/ a
>> different offset it works the first time.
>> The first time ONLY. But actually it doesn't work, it just doesn't error
>> the first run.
>> Subsequent runs tell me that relation ######## doesn't exist, at the
>> FOR...LOOP line, after ALTERing the table.
>>
>> I build the string and it's good:
>> CREATE TABLE temp_gentokenstable AS SELECT businessid, publicname FROM
>> businesscontact ORDER BY businessid OFFSET 200000 LIMIT 10000 ;
>>
>> I'm forced to use v7.4.
>>
>> If this is a known error, can I (with the version ; ^) ) get around it?
>>
>
>
>
>> Ultimately I need to FOR..LOOP through through records and the table and
>> cols will change. Any suggestions???
>>
>>
>
> use a EXECUTE statement and FOR IN EXECUTE statement
>
> regards
>
> Pavel Stehule
>
>
>
>> THANKS!
>>
>> --
>>
>> Ralph
>> _________________________
>>
>>

--

Ralph
_________________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2011-02-22 20:28:32 Re: why is there no TRIGGER ON SELECT ?
Previous Message Ralph Smith 2011-02-22 19:48:23 Re ==> EXECUTE of a 'create table' string is not happening