Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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>
  • Cc: pgsql-sql(at)postgresql(dot)org
  • Subject: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression
  • Date: Thu, 8 Feb 2007 04:23:31 -0700
  • Message-id: <20070208112331(dot)GA75899(at)winnie(dot)fuhr(dot)org>

On Wed, Feb 07, 2007 at 02:43:13PM -0800, Greg Wittel wrote:
> I'm having a strange problem with a PL/PGSQL query that executes some 
> dynamic SQL code.  The code basically creates a dynamically named table, 
> some indexes, etc.
> 
> The problem seems to be the an index expression. If I remove it and do a 
> plain index on the column, all works correctly.  If I keep it, I get a 
> "relation does not exist" error.

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);

In 8.2.3 the error location is:

LOCATION:  RangeVarGetRelid, namespace.c:200

-- 
Michael Fuhr



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group