EXECUTE of a 'create table' string is not happening - Mailing list pgsql-general

From Ralph Smith
Subject EXECUTE of a 'create table' string is not happening
Date
Msg-id 4D6408DB.5080707@10kinfo.com
Whole thread Raw
Responses Re: EXECUTE of a 'create table' string is not happening  ("David Johnston" <polobo@yahoo.com>)
Re: EXECUTE of a 'create table' string is not happening  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general
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???

THANKS!
-- 

Ralph
_________________________

pgsql-general by date:

Previous
From: Howard Cole
Date:
Subject: Re: Reordering a table
Next
From: "David Johnston"
Date:
Subject: Re: EXECUTE of a 'create table' string is not happening