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:33:23 -0800
Message-ID: <201201090833.24042.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:

>      tablename
> --------------------
>  tmp_staging0109
>  tmp_staging1229
>  tmp_staging0108
> 
> How can I write this correctly?

Had another idea. If you are looking for the highest numbered table below a 
certain number then maybe this:

test(5432)aklaver=>\d name_test 
        Table "public.name_test"
 Column |       Type        | Modifiers 
--------+-------------------+-----------
 fld_1  | character varying | 

test(5432)aklaver=>SELECT * from name_test ;
      fld_1      
-----------------                                                                                                                                                                  
 tmp_staging0109                                                                                                                                                                   
 tmp_staging0108                                                                                                                                                                   
 tmp_staging1229                                                                                                                                                                   
(3 rows)                                                                                                                                                                           
                                                                                                                                                                                   
test(5432)aklaver=>select fld_1 from name_test where fld_1 like 'tmp_staging%' and 
fld_1< 'tmp_staging1230' order by fld_1 desc limit 1;                                
      fld_1                                                                                                                                                                        
-----------------                                                                                                                                                                  
 tmp_staging1229                      


> 
> Thanks.
> Tony

-- 
Adrian Klaver
adrian.klaver@gmail.com



view thread (9+ messages)  latest in thread

Message-ID: <201201090833.24042.adrian.klaver@gmail.com>
Permalink:  ../201201090833.24042.adrian.klaver@gmail.com/
Also on:    postgresql.org/message-id/201201090833.24042.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: <201201090833.24042.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