[wp-hackers] PostgreSQL port status?
tbarta at gmail.com
Tue Oct 2 12:44:13 GMT 2007
On 10/1/07, Matt Mullenweg <m at mullenweg.com> wrote:
> usleepless at gmail.com wrote:
> > why are there `'s in that query?
> > what are they good for?
> Because if a field name or table name conflicts with a MySQL reserved
> keyword the query will fail with a cryptic error messages, so it's good
> practice to put the `` quotes around them all.
An alternative is to avoid using reserved keywords as table/field
names. It depends on which you think is uglier:
SELECT `timestamp` FROM `group`;
SELECT timestamp_, stamp, (etc.) from group_;
or any other number of one-off tweaks
IMO it's better to avoid using reserved keywords; it's not difficult
to do, even for cross-DB-platform development. It eliminates the
possibility of forgetting backticks, and it's less dependent on the
database engine (PG uses double-quotes to escape literals, for
example) than common keywords.
If you ever want to see backtick-hell in MySQL, execute SHOW CREATE
VIEW for any nontrivial view.
More information about the wp-hackers