Skip site navigation (1) Skip section navigation (2)

Re: Best practice to move from MySQL to PostgreSQL

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Best practice to move from MySQL to PostgreSQL
Date: 2010-12-02 07:49:15
Message-ID: id7j1q$3li$1@dough.gmane.org (view raw or flat)
Thread:
Lists: pgsql-novice
Guenther Boelter, 02.12.2010 05:04:
> so a query looks like this
>
> SELECT BelegNummer, BelegDatum FROM rechnungen ORDER BY BelegDatum ASC;
>
> This will not work with PostgreSQL, because PostgreSQL will change all fieldnames to lowercase, right?
> Means, I've to change all fieldnames to lowercase like belegnummer, belegdatum ....

No you don't need to change the statements - at least not if they *don't* use doubles quotes.

As long as you don't use double quotes, the names are not case-sensitive (as required by the standard)
So just make sure you don't quote your table and column names and you should be fine.

The following statements are equivalent:

SELECT BELEGNUMMER FROM RECHNUNGEN
select belegnummer from rechnungen
SELECT belegnummer FROM rechnungen
SELECT BeLeGnUmMer FROM rechnungen
...


>  Should I change my queries to something like this:
>
>> SELECT belegnummer, belegdatum FROM rechnungen ORDER BY belegdatum ASC;
No need to do that.

Regards
Thomas


In response to

pgsql-novice by date

Next:From: Jasen BettsDate: 2010-12-02 11:58:03
Subject: Re: Get server's time in UTC time zone, in ISO 8601 format
Previous:From: Guenther BoelterDate: 2010-12-02 04:04:36
Subject: Best practice to move from MySQL to PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group