Re: visibility rule in a EXECUTE with multi sql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: laser <laserlist(at)pgsqldb(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: visibility rule in a EXECUTE with multi sql
Date: 2008-04-10 14:23:10
Message-ID: 1142.1207837390@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

laser <laserlist(at)pgsqldb(dot)com> writes:
> when I do a:

> execute 'set search_path to bar; create table foo(f1 int);insert into
> table foo blah..blah;'

> in plpgsql, I found that the insert statement always report that "can't
> found table foo" or something
> like that.

Well, yeah. The whole string is parsed, then executed, so you are
trying to parse the insert before foo exists. Break it into multiple
EXECUTEs. Or maybe you want "create table as select ...".

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2008-04-10 14:23:50 Proper Installation of Postgres and Postgis on 10.5 Intel
Previous Message William Temperley 2008-04-10 14:06:18 percentile rank query