Re: [SQL] Character type name?? How to lower case it?

From: Guido(dot)Goldstein(at)t-online(dot)de (Guido Goldstein)
To: Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl>
Cc: Douglas Nichols <dnichols(at)fhcrc(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Character type name?? How to lower case it?
Date: 1999-01-29 11:42:36
Message-ID: lt3e4ui9ub.fsf@Guido.Goldstein.dialup.t-online.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Moin!

On Fri, 29 Jan 1999 09:43:33 +0100 (MET)
Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl> wrote:
> >
> > I have this script:
> > SELECT a.attname, t.typname, a.attlen
> > FROM pg_class c, pg_attribute a, pg_type t
> > WHERE c.relname = 'regis' and a.attname in
> > ('var1','var2',var3');
> >
> > but a.attname is of type name, inwhich text(..) or lower(..)
> > do not work with this type and I do not seem to be able to
> > convert type name to text....
> >
> > Can someone help me get around this?
> >
>
> You could use case-insensitive regex operator - Your query should looks
> like following:
> SELECT a.attname, t.typname, a.attlen
> FROM pg_class c, pg_attribute a, pg_type t
> WHERE c.relname = 'regis' and (a.attname ~*'var1' OR
> a.attname~*'var2' OR a.attname~*'var3');

Why not
[...]
WHERE c.relname = 'regis' and a.attname ~* 'var[1-3]'
[...]

It's a regex, remember?
The OR isn't necessary.

HIH
&
HAND
Guido
--
Monday is an awful way to spend 1/7th of your life.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message novikov 1999-01-29 13:07:07 ORDER BY
Previous Message Remigiusz Sokolowski 1999-01-29 08:43:33 Re: [SQL] Character type name?? How to lower case it?