Inserting all defaults

Started by Richard Harvey Chapmanalmost 26 years ago4 messagesgeneral
Jump to latest
#1Richard Harvey Chapman
hchapman@3gfp.com

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.

#2Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Richard Harvey Chapman (#1)
Re: Inserting all defaults

Is it possible to do an insert with no values?

insert tablename default values;

- Thomas

#3Mitch Vincent
mitch@venux.net
In reply to: Richard Harvey Chapman (#1)
Linux/Postgre question.

In order to take advantage of some new hardware I had to use Linux over
FreeBSD.. I use to run my backend with the options -B 4096 -o '-S 16384' but
remember I had to modify the FreeBSD kernel to allow processes to use that
much shared memory... How would I go about doing that in Linux? I've been
out of the Linux loop for some time (obviously) -- Thanks!

-Mitch

#4Hernan Gonzalez
hgonzal@sinectis.com.ar
In reply to: Mitch Vincent (#3)
Re: Linux/Postgre question.

In order to take advantage of some new hardware I had to use Linux over
FreeBSD.. I use to run my backend with the options -B 4096 -o '-S 16384' but
remember I had to modify the FreeBSD kernel to allow processes to use that
much shared memory... How would I go about doing that in Linux? I've been
of the Linux loop for some time (obviously) -- Thanks!

I use:

echo "100000000" > /proc/sys/kernel/shmmax

in my postgresql init script.
Check the number and the existence of shmmax file
in your system (it's there since Linux 2.2.0, I believe).

Regards

Hernan Gonzalez