Menim databazi z mysql na postgres a vyskytnul se (mimo jine) tento problem:
V tabulce mam sloupec s nazvem 'user'. Ale postgres ho z nejakeho duvodu nebere (asi nejake klicove slovo):
create table tabulka (
id serial primary key,
aaa varchar(60) not null,
bbb varchar(60) not null,
user varchar(60) not null
);
(je to tim urcite protoze jiny nazev nez user jde)
Napadlo me zatim jen oznacit vsechny nazvy takto: `user`, coz taky nepomaha.
Menit nazev bych nechtel, protoze sloupec user mam celkem v 8 tabulkach a hojne se vyskytuje i ve skriptech.
Takze mate-li na to nekdo figl budu rad.
Double quotes can also be used to protect a name that would otherwise be taken to be an SQL keyword. For example, IN is a keyword but "IN" is a name.
z http://www.postgresql.org/docs/7/interactive/syntax525.htm
takze
...
bbb varchar(60) not null,
"user" varchar(60) not null
);
by melo pomoct..