Inserting all defaults

From: Richard Harvey Chapman <hchapman(at)3gfp(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Inserting all defaults
Date: 2000-06-27 01:05:12
Message-ID: Pine.LNX.4.10.10006261759270.10570-100000@smile.3gfp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it possible to do an insert with no values?

e.g.

CREATE TABLE a (num INTEGER DEFAULT 1);
INSERT INTO a; or INSERT INTO a VALUES ();

I'd like to do this when a database is first created to insert the default
set of values that I have for every table e.g. a default system
configuration.

This might appear more useful like so:

CREATE TABLE config (
config_code SERIAL PRIMARY KEY,
parameter_1 INTEGER DEFAULT 999,
parameter_2 INTEGER DEFAULT 2000
);

INSERT INTO config;

CREATE TABLE device (
device_code SERIAL PRIMARY KEY,
config_code INTEGER REFERENCES config DEFAULT 1 NOT NULL,
);

Thanks,

R.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Lockhart 2000-06-27 01:30:49 Re: Function to convert from (integer) UNIXTIME to DATETIME
Previous Message Richard Harvey Chapman 2000-06-27 00:04:46 Re: Postgresql and programming