Re: [GENERAL] Create an empty record

2001-05-19 Thread Stephan Szabo


I believe it's:
insert into product default values;

(Don't blame us, blame the standard... :) )

On Sat, 19 May 2001, Per-Olof Pettersson wrote:

> Hi
> 
> How would one goabout creating an empty record (for use in relations).
> 
> I have tried INSERT INTO product() VALUES(); but as expected it did not 
> work.


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[GENERAL] Inheritance and reference integrity

2001-05-19 Thread Jani Averbach


Hi!

I wonder why following SQL-sequence will fail:

-- DROP TABLE car;
-- DROP TABLE vehicle;
-- DROP SEQUENCE vehicle_id_seq;
 
CREATE TABLE vehicle(
id  SERIAL,
color   TEXT,
--
CONSTRAINT PK_vehicle PRIMARY KEY (id)
);
 
 
CREATE TABLE car(
driver  TEXT
)INHERITS(vehicle);
 
 
-- DROP TABLE foobar;
 
CREATE TABLE foobar(
snafu   TEXT,
driver_id  INTEGER CONSTRAINT CR_foobar_driver_id REFERENCES car (id)
);

Result:

psql:inherits_test.sql:25: NOTICE:  CREATE TABLE will create implicit
trigger(s) for FOREIGN KEY check(s)
psql:inherits_test.sql:25: ERROR:  UNIQUE constraint matching given keys
for referenced table "car" not found


Is it just me or postgres? =)

BR, Jani

P.S. My Postgresql's version number is 7.1.

---
Jani Averbach 


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[GENERAL] Compiling for Caldera

2001-05-19 Thread R Talbot

Tom Regarding message below...

 With all said and done below does this all indicate to compile and
ignore the
errors or Should I wait for   .. AC_EGREP_HEADER.. to be added to source

before I attempt to compile under Caldera 2.3 eDesktop

BoB T
*

Author: Tom Lane <[EMAIL PROTECTED]>
Date: Mon 23 Apr 10:24:59 2001 EDT
Subject: Re: Error compiling 7.1 on Caldera OpenLinux

Bruce MacKay  writes:
> Seems you've hit the problem right on the head.  I did a find for
zlib.h and
> found two different versions of the file on my system.
> The copy in /usr/include did not have z_streamp defined.  The copy in
> /usr/src/linux-2.2.14/drivers/net did have a definition.

Okay.  I think we'll just state that we require zlib 1.0.4 or newer;
since that's pretty far back, it doesn't bother me a lot to do so.
(Current zlib release is 1.1.3, last I looked.)

I suppose we could add an AC_EGREP_HEADER test to see if
defines z_streamp or not; is that worth the trouble?

regards, tom lane


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] Re: Create an empty record

2001-05-19 Thread Per-Olof Pettersson

Oh I forgot

Naturally it works with setting eg procuct in this case to null but it 
does not seem very clean.

INSERT INTO product(product) VALUES(null);

Does anybody have a clean way to do this?

Best regards
Per-Olof Pettersson

>> Original Message <<

On 2001-05-19, 21:24:54, Per-Olof Pettersson <[EMAIL PROTECTED]> wrote 
regarding Create an empty record:


> Hi

> How would one goabout creating an empty record (for use in relations).

> Eg
> create table product(
>   productid   SERIAL NOT NULL,
>   product TEXT,
>   PRIMARY KEY(productid)
> );

> create table product_billable(
>   productid   INT4 NOT NULL,
>   billaddress TEXT,
>   PRIMARY KEY (productid),
>   FOREIGN KEY (productid) REFERENES product(productid) ON DELETE 
CASCADE
> );

> All fields except for the primary key can be NULL.

> What if I wanted to add a new billable product but I have not got a name
> for it yet?

> So how could I insert a new record in product that can be used in
> product_billable?

> I have tried INSERT INTO product() VALUES(); but as expected it did not
> work.

> All help appreciated
> Best regards
> Per-Olof Pettersson

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [GENERAL] Can not drop sequence...

2001-05-19 Thread Neil Conway

On Thu, May 17, 2001 at 09:43:41AM -0400, D0 wrote:
> Also how do I get a listing of the sequences already created?

/ds from inside psql. To get the actual SQL that is used, start
psql with '-E'.

Cheers,

Neil


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[GENERAL] Re: Compiling for Caldera

2001-05-19 Thread Tom Lane

R Talbot <[EMAIL PROTECTED]> writes:
> errors or Should I wait for   .. AC_EGREP_HEADER.. to be added to source

It's already in 7.1.1.

regards, tom lane

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[GENERAL] Why can't I do this (setup question)

2001-05-19 Thread Paul Tomblin

I've got PostgreSQL 7.1 installed from rpms on a RedHat 6.2 system.  I
want the data directory on a separate partition, so I shut down, tar the
whole directory into the other directory, mount it, and when I start up
postgresSQL it says it's up, but I can't connect to any databases using
psql.
psql: connectDBStart() -- connect() failed: Connection refused
Is the postmaster running locally
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
There is a postmaster running, but no socket in /tmp/

Here's the whole sequence of commands as root:
mkdir data.new
chown postgres.postgres data.new
mount /dev/hdc6 data.new
cd data.new
(cd ../data; tar cvBf - .) | tar xvBpf -
cd ..
mv data data.old
umount data.new
mkdir data
chown postgres.postgres data
mount /dev/hdc6 data
/etc/rc.d/init.d/postgresql start

Is there a way to make this work, or am I going to have to export and
import?

-- 
Paul Tomblin <[EMAIL PROTECTED]>, not speaking for anybody
Command, n.:
Statement presented by a human and accepted by a computer in
such a manner as to make the human feel as if he is in control.

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [GENERAL] Why can't I do this (setup question)

2001-05-19 Thread Tom Lane

Paul Tomblin <[EMAIL PROTECTED]> writes:
> I've got PostgreSQL 7.1 installed from rpms on a RedHat 6.2 system.  I
> want the data directory on a separate partition, so I shut down, tar the
> whole directory into the other directory, mount it, and when I start up
> postgresSQL it says it's up, but I can't connect to any databases using
> psql.
> psql: connectDBStart() -- connect() failed: Connection refused
> Is the postmaster running locally
> and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
> There is a postmaster running, but no socket in /tmp/

Odd.  Seems unlikely that that has anything to do with your having moved
the data directory.  Any interesting messages in the postmaster log?
Can you connect via TCP?

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]