X-Original-To: pgsql-sql@postgresql.org Received: from lapcrew.com (pcp01360251pcs.benslm01.pa.comcast.net [68.81.104.121]) by postgresql.org (Postfix) with ESMTP id 278224763E3 for ; Fri, 7 Mar 2003 11:47:38 -0500 (EST) Received: from Spooler by lapcrew.com (Mercury/32 v3.31) ID MO000412; 6 Mar 03 11:42:58 -0600 Received: from spooler by lapcrew.com (Mercury/32 v3.31); 6 Mar 03 11:42:40 -0600 Received: from [194.54.43.44] (146.145.38.11) by Lapcrew Mail Server (Mercury/32 v3.31) with ESMTP ID MG000411; 6 Mar 03 11:42:34 -0600 Subject: Re: Underscores in column names From: Mark Mitchell To: Richard Huxton Cc: pgsql-sql@postgresql.org In-Reply-To: <200303071628.11980.dev@archonet.com> References: <1047052681.24305.6.camel@sql.icnfull.com> <200303071628.11980.dev@archonet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 07 Mar 2003 12:17:29 -0500 Message-Id: <1047057449.24306.10.camel@sql.icnfull.com> Mime-Version: 1.0 X-Archive-Number: 200303/200 X-Sequence-Number: 12240 You are 100% correct Rich. I changed the query to use substr() instead of substring() and it works fine. Thanks for your quick answer. - Mark On Fri, 2003-03-07 at 11:28, Richard Huxton wrote: > On Friday 07 Mar 2003 3:58 pm, Mark Mitchell wrote: > > I have a underscores in most all of the column names in this database. > > I've ran into a problem where Postgres doesn't like them. > > > > SELECT * FROM "NATAB" WHERE > > "NATAB"."NA_LAST_NAME" LIKE 'MITCHELL%' AND > > SUBSTRING("NATAB"."NA_NAME",0,"NATAB"."NA_COLON") LIKE 'MARK%' > > > > Produces the error : "ESCAPE string must be empty or one character" > > > > The column "NA_COLON" is a column that holds the numeric position at > > which the first name ends and the last name begins. If the column name > > does not contain an underscore it works fine. Any suggestions? > > Are you sure you don't mean substr() rather than substring()? I think the form > you're using does a POSIX regexp match and uses the third param as an escape > character. > > -- > Richard Huxton > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html