pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@gmail.com>
To: pgsql-sql@postgresql.org
Cc: Tony Capobianco <tcapobianco@prospectiv.com>
Subject: Re: compare table names
Date: Mon, 9 Jan 2012 08:19:47 -0800
Message-ID: <201201090819.48041.adrian.klaver@gmail.com> (raw)
In-Reply-To: <1326125538.1983.12.camel@tony1.localdomain>
References: <1326125538.1983.12.camel@tony1.localdomain>

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.klaver@gmail.com



view thread (9+ messages)  latest in thread

Message-ID: <201201090819.48041.adrian.klaver@gmail.com>
Permalink:  ../201201090819.48041.adrian.klaver@gmail.com/
Also on:    postgresql.org/message-id/201201090819.48041.adrian.klaver@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: adrian.klaver@gmail.com, tcapobianco@prospectiv.com
  Subject: Re: compare table names
  In-Reply-To: <201201090819.48041.adrian.klaver@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox