pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Fuhr <mike@fuhr.org>
Cc: Greg Wittel <gwittel@proofpoint.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression
Date: Thu, 08 Feb 2007 10:32:25 -0500
Message-ID: <8064.1170948745@sss.pgh.pa.us> (raw)
In-Reply-To: <20070208150746.GA77230@winnie.fuhr.org>
References: <45CA5601.1090007@proofpoint.com>
	<20070208112331.GA75899@winnie.fuhr.org>
	<20070208141433.GD24069@alvh.no-ip.org>
	<20070208150746.GA77230@winnie.fuhr.org>

Michael Fuhr <mike@fuhr.org> writes:
> 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);

It's only by chance that it works in that case: the current coding of
transformIndexStmt happens not to try to touch the underlying table
if there aren't any expressions to analyze.  You can make a large number
of variants that will fail, eg, create the table and try to insert into
it in one command string.

My advice is not to try to execute multiple commands in the same EXECUTE
string --- if we were going to do anything to "fix" this, I think it
would be along the lines of enforcing that advice.  Trying to make the
world safe for it doesn't sound productive.

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <8064.1170948745@sss.pgh.pa.us>
Permalink:  ../8064.1170948745@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8064.1170948745@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mike@fuhr.org, gwittel@proofpoint.com
  Subject: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression
  In-Reply-To: <8064.1170948745@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox