inserting values like in mySQL

Поиск
Список
Период
Сортировка
От Peter Asemann
Тема inserting values like in mySQL
Дата
Msg-id Pine.GSO.4.02A.10105181746010.14265-100000@eliza.rrze.uni-erlangen.de
обсуждение исходный текст
Ответы Re: inserting values like in mySQL  (Nabil Sayegh <imap@sayegh.de>)
Список pgsql-novice
Hi there!

We (me and others from my group)  have to convert mySQL syntax to
PostGreSQL, and incidentally we had some problems.

We have a table named users with ID, name, pass as columns.

In mySQL we had the column "ID" set to auto-increment. It took us some
time to find out how to use the "serial" feature ;-)

In mySQL it was like this:

insert into users values ('','peter','my_pass');

In PostGreSQL this does not work. The only thing that works is

insert into users (name,pass) values ('peter','my_pass');

Apparently this is longer, and we'll have tables with much more columns,
so we'll have to write much more than in mySQL, and as we're lazy people
(all programmers are, Larry Wall says), we don't want to write a single
character more than necessary.

Is there a way to set all columns without explicitly giving their
names? Isn't there something to indicate that the value we give to the
database is only a dummy like the '' in mySQL?

Hope you got the point... maybe this question is really stupid and I
managed to overlook the hints written in 20-pixels height on page one of
the "PostGreSQL manual for complete morons" dealing with this problem ;-)

Thanks for reading,

---------------------------------------------------------
Peter Asemann                 unrzb8@rrze.uni-erlangen.de



В списке pgsql-novice по дате отправления:

Предыдущее
От: Sandro Dentella
Дата:
Сообщение: ANNOUNCE: tksql (program) & sdsql (Tcl/Tk package)
Следующее
От: imap@sayegh.de
Дата:
Сообщение: Re: toast examples.