Re: Blank SQL insert statements

From: Allan Engelhardt <allane(at)cybaea(dot)com>
To: "Ashley (at) Turton" <ashley(at)turton(dot)com>
Subject: Re: Blank SQL insert statements
Date: 2001-10-17 09:47:23
Message-ID: 3BCD53AB.9030404@cybaea.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm not really recommending what you are trying to do [I prefer an INSERT with
all the values instead of UPDATE-ing the table multiple times...], but

INSERT INTO x DEFAULT VALUES;

should more or less do what you want. Of course the table must have default
values defined to satisfy any constraints or you can't sensibly insert an
'empty' column.

Allan.

Ashley @ Turton wrote:

> I am developing a system to take a generic data structure and store it in a
> PostgreSQL database. The data structure contains several entries of the
> following:
>
> insert a record into table1
> field1 value1
> field2 value2
>
> insert a record into table2
> field1 value1
> field2 value2
>
> Data for different tables is stored in each 'data set'. When I get this to
> the database I want to:
>
> insert a blank record into tablex
> populate fieldx of new record with valuex
>
> I could implement this with some if statements based on the table name, then
> INSERT INTO x (...) VALUES (...), but I would prefer to kept the structure
> as generic as possible. Is it possible in PostgreSQL to construct a blank
> record without specifying a list of fields and values in an INSERT statement
> (so I can perform a collection for UPDATEs to populate the blank record)?
>
>
> Ashley
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Allan Engelhardt 2001-10-17 10:08:24 What is the syntax for unicode characters?
Previous Message Allan Engelhardt 2001-10-17 09:25:30 Re: postgresql 7.1.3