compare table names

From: Tony Capobianco <tcapobianco(at)prospectiv(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: compare table names
Date: 2012-01-09 16:12:18
Message-ID: 1326125538.1983.12.camel@tony1.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

Thanks.
Tony

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2012-01-09 16:19:47 Re: compare table names
Previous Message cc "maco" young 2012-01-06 09:17:08 notes on materialized views