Re: Quirks in Sorting Pg_description

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: P <user2037(at)live(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Quirks in Sorting Pg_description
Date: 2010-03-03 15:13:49
Message-ID: 24383.1267629229@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

P <user2037(at)live(dot)com> writes:
> The following query works from Psql's prompt but not from Psql's "-c"
> command or from PHP's PDO interface.

> SELECT description FROM pg_catalog.pg_description WHERE description
> SIMILAR TO '\d+' ORDER BY description::integer DESC LIMIT 1;

1. I think you'll find that "SIMILAR TO '\d+'" doesn't do what you
think; or at least, if it does, that's an implementation artifact
not to be relied on. Use a POSIX regex operator instead.

2. Perhaps the context sensitivity of the behavior is explained by the
shell or PHP eating the backslash? It certainly seems like you're at
risk for different numbers of levels of backslash processing in these
cases.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Iñigo Martinez Lasala 2010-03-03 15:26:25 Re: password authentication failed for user postgres
Previous Message Major Services 2010-03-03 14:37:23 Re: password authentication failed for user postgres