Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id D3E1D633DF8 for ; Wed, 3 Mar 2010 11:14:02 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 21729-05 for ; Wed, 3 Mar 2010 15:13:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 04668632FDD for ; Wed, 3 Mar 2010 11:13:51 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o23FDnrV024384; Wed, 3 Mar 2010 10:13:49 -0500 (EST) To: P cc: pgsql-admin@postgresql.org Subject: Re: Quirks in Sorting Pg_description In-reply-to: References: Comments: In-reply-to P message dated "Wed, 03 Mar 2010 09:15:50 -0500" Date: Wed, 03 Mar 2010 10:13:49 -0500 Message-ID: <24383.1267629229@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.249 tagged_above=-10 required=5 tests=AWL=-1.064, BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201003/28 X-Sequence-Number: 33827 P 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