inserting values like in mySQL - Mailing list pgsql-novice

From Peter Asemann
Subject inserting values like in mySQL
Date
Msg-id Pine.GSO.4.02A.10105181746010.14265-100000@eliza.rrze.uni-erlangen.de
Whole thread Raw
Responses Re: inserting values like in mySQL  (Nabil Sayegh <imap@sayegh.de>)
List 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 by date:

Previous
From: Sandro Dentella
Date:
Subject: ANNOUNCE: tksql (program) & sdsql (Tcl/Tk package)
Next
From: imap@sayegh.de
Date:
Subject: Re: toast examples.