inserting values like in mySQL

From: Peter Asemann <Peter(dot)Asemann(at)rrze(dot)uni-erlangen(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: inserting values like in mySQL
Date: 2001-05-18 16:03:25
Message-ID: Pine.GSO.4.02A.10105181746010.14265-100000@eliza.rrze.uni-erlangen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)rrze(dot)uni-erlangen(dot)de

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Manuel Sugawara 2001-05-18 16:22:00 Re: SQL query help - online music shop - labels & styles
Previous Message Nabil Sayegh 2001-05-18 13:00:45 Re: SQL query help - online music shop - labels & styles