pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Oden <joden@lee.k12.nc.us>
To: Marc Eggenberger <me@ieo.ch>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Re: [GENERAL] Still the problem with the autoincrement field
Date: Tue, 6 Oct 1998 07:48:20 -0400
Message-ID: <01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us> (raw)

|
|So, what you should do is:
|
|INSERT INTO offene_stellen (
|    bezeichnung,
|    arbeitsort,
|    berater
|    gefordert
|    geboten
|)
|VALUES (
|    'Maurer',
|    'Buchs',
|    'Rheinhalter Claudio',
|    'flexibilitaet',
|    'gutes Team'
|);
|
|This works, and it also makes sure that if you change the schema such that
|the order of the fields is different or there are new fields between the
|existing fields, the query won't break.

Also, if you are working with a program where the user may want to updated
only certain fields you can do that without paying any attention to the
order of the fields in the table.  I tried to do it the other way with NULLs
and such, and its just a real hassle once you change the the structure of
the database to go back and make your code conform to the new structure.

|
|But if you insist on not mentioning field names, I think inserting a NULL
|rather than a value in the id field should work. I won't swear on it,

It works, but I definately agree with Herouth...don't do it...its a bad
idea.  You will save yourself much work in the long run if you just include
the column names in the update query, and besides if you are embedding this
query in a program there should be no problem at all. You type the query
once, and provided you typed it correctly, forget about it.

...james




view thread (4+ messages)

Message-ID: <01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us>
Permalink:  ../01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us/
Also on:    postgresql.org/message-id/01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: joden@lee.k12.nc.us, me@ieo.ch, herouth@oumail.openu.ac.il
  Subject: Re: [SQL] Re: [GENERAL] Still the problem with the autoincrement field
  In-Reply-To: <01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us>
  References: <01e501bdf11f$43f8c920$01cc0cac@Yehudah.lee.k12.nc.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox