Re: compare table names

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: Tony Capobianco <tcapobianco(at)prospectiv(dot)com>
Subject: Re: compare table names
Date: 2012-01-09 16:19:47
Message-ID: 201201090819.48041.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Monday, January 09, 2012 8:12:18 am Tony Capobianco wrote:
> I have these 3 tables:
>
> tablename
> --------------------
> tmp_staging0109
> tmp_staging1229
> tmp_staging0108
>
>
> I'd like this query:
>
> select tablename from pg_tables where tablename like 'tmp_staging%' and
> tablename < 'tmp_staging1230';
>
> To return this result:
>
> tablename
> --------------------
> tmp_staging1229
>
> However, I'm receiving:
>
> tablename
> --------------------
> tmp_staging0109
> tmp_staging1229
> tmp_staging0108
>
> How can I write this correctly?

As far as I can tell it is correct. 0108,0109 and 1229 are all less than 1230.
What happens if you do?:

select tablename from pg_tables where tablename like 'tmp_staging%' and
tablename < 'tmp_staging1230' and tablename > 'tmp_staging1228;

>
> Thanks.
> Tony

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tony Capobianco 2012-01-09 16:28:43 Re: compare table names
Previous Message Tony Capobianco 2012-01-09 16:12:18 compare table names