Re: MySQL search query is not executing in Postgres DB
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Christopher Browne <cbbrowne@gmail.com>, premanand <kottiprem@gmail.com>, pgsql-hackers@postgresql.org
Date: 2012-02-17T20:04:59Z
Lists: pgsql-hackers
On Fri, Feb 17, 2012 at 2:44 PM, Andrew Dunstan <andrew@dunslane.net> wrote: > Strings of digits used that way should not be stored in numeric fields at > all, IMNSHO, just as zip codes and phone numbers should not be. They should > be text in the first place, and if the OP had done that he wouldn't have had > any difficulty about this. I hope that's what the Lone Ranger would do ... The argument isn't about whether the user made the right design choices; it's about whether he should be forced to insert an explicit type cast to get the query to do what it is unambiguously intended to do. I don't believe it's entirely self-evident that it's always better to store strings of integers in a text column rather than as an integer or bigint - integers are pretty fast and compact. Even granting that a text field would have been better, nobody's arguing that you can't do LIKE against an integer column; we're just discussing what syntax is required to make the user's intent acceptably clear. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company