X-Original-To: pgsql-sql@postgresql.org Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id 01EE4476491 for ; Fri, 7 Mar 2003 11:29:27 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 18rKin-0002C8-0Z; Fri, 07 Mar 2003 16:29:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 7E79717AEB; Fri, 7 Mar 2003 16:29:01 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id BBB5517AE8; Fri, 7 Mar 2003 16:29:00 +0000 (GMT) Content-Type: text/plain; charset="utf-8" From: Richard Huxton Organization: Archonet Ltd To: Mark Mitchell , pgsql-sql@postgresql.org Subject: Re: Underscores in column names Date: Fri, 7 Mar 2003 16:28:11 +0000 User-Agent: KMail/1.4.3 References: <1047052681.24305.6.camel@sql.icnfull.com> In-Reply-To: <1047052681.24305.6.camel@sql.icnfull.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200303071628.11980.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Archive-Number: 200303/199 X-Sequence-Number: 12239 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 f= orm=20 you're using does a POSIX regexp match and uses the third param as an escap= e=20 character. --=20 Richard Huxton