Thread: pg_tables query issue

pg_tables query issue

From
kevin kempter
Date:
Hi List;

I've found that if I run this select (below) I get a table returned
named 'dma' een though I specified like 'dm_%' :


select tablename from pg_tables where tablename like 'dm_%';


           tablename
------------------------------
  dm_service_provider_dim
  dma


Am I missing something or is this a bug ?

Thanks in advance..

/Kevin






Re: pg_tables query issue

From
Stephan Szabo
Date:
> I've found that if I run this select (below) I get a table returned
> named 'dma' een though I specified like 'dm_%' :

Underscore is a special character for like matching any single character
so I don't think that's wrong.

Re: pg_tables query issue

From
kevin kempter
Date:
OK. Thanks for the info.


On Jun 30, 2008, at 5:48 PM, Stephan Szabo wrote:

>
>> I've found that if I run this select (below) I get a table returned
>> named 'dma' een though I specified like 'dm_%' :
>
> Underscore is a special character for like matching any single
> character
> so I don't think that's wrong.
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin


Re: pg_tables query issue

From
Lennin Caro
Date:
Hi List;

I've found that if I run this select (below) I get a table returned
named 'dma' een though I specified like 'dm_%' :


select tablename from pg_tables where tablename like 'dm_%';


           tablename
------------------------------
  dm_service_provider_dim
  dma


Am I missing something or is this a bug ?


Thanks in advance..


/Kevin





>> the '_' character is a especial character like the '%'.... Try use this

>>select * from table where name ilike('dm\\_%')