Re: Underscores in column names

From: Mark Mitchell <mark(at)lapcrew(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Underscores in column names
Date: 2003-03-07 17:17:29
Message-ID: 1047057449.24306.10.camel@sql.icnfull.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-03-07 17:41:41 Re: How to notice column changes in trigger
Previous Message Tom Lane 2003-03-07 17:13:14 Re: Hex Integer Input