Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 650199FB2B2 for ; Thu, 8 Feb 2007 11:07:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 21298-06 for ; Thu, 8 Feb 2007 11:07:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id A49E39FB2AF for ; Thu, 8 Feb 2007 11:07:52 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l18F7l9F007575 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Feb 2007 08:07:50 -0700 (MST) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l18F7lWG077828; Thu, 8 Feb 2007 08:07:47 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l18F7lCg077827; Thu, 8 Feb 2007 08:07:47 -0700 (MST) (envelope-from mfuhr) Date: Thu, 8 Feb 2007 08:07:47 -0700 From: Michael Fuhr To: Greg Wittel , pgsql-sql@postgresql.org Subject: Re: Odd PL/PgSQL Error -- relation "X" does not exist when using index expression Message-ID: <20070208150746.GA77230@winnie.fuhr.org> References: <45CA5601.1090007@proofpoint.com> <20070208112331.GA75899@winnie.fuhr.org> <20070208141433.GD24069@alvh.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070208141433.GD24069@alvh.no-ip.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/86 X-Sequence-Number: 27420 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