Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Greg Wittel <gwittel(at)proofpoint(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression
Date: 2007-02-08 15:07:47
Message-ID: 20070208150746.GA77230@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Feb 08, 2007 at 11:14:33AM -0300, Alvaro Herrera wrote:
> Michael Fuhr wrote:
> > The error appears to happen for anything that uses SPI. A C function
> > that executes the following fails with the same error:
> >
> > SPI_exec("CREATE TABLE foo (t text); CREATE INDEX foo_idx ON foo (lower(t))", 0);
>
> Hmm, are we short of a CommandCounterIncrement in the middle of both
> commands? Does the same error show up if you do
>
> SPI_exec("CREATE TABLE foo (t text);", 0);
> SPI_exec("CREATE INDEX foo_idx ON foo (lower(t))", 0);

Using separate calls to SPI_exec() works. Using a single call to
SPI_exec() works if the index is on (t) instead of (lower(t)):

SPI_exec("CREATE TABLE foo (t text); CREATE INDEX foo_idx ON foo (t)", 0);

--
Michael Fuhr

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrien Lebre 2007-02-08 15:12:16 unsubscribe
Previous Message Wilkinson, Jim 2007-02-08 14:45:26 unsubscribe