Re: [SQL] Parent table has not oid?

2002-11-10 Thread Tom Lane
"Zhidian Du" <[EMAIL PROTECTED]> writes:
> CREATE TABLE Link (
>Protein_ID oid
>CONSTRAINT one
>REFERENCES Protein (oid)
>ON DELETE CASCADE,
>Link varchar(128)
> );
> When I insert a record into this child table, it says
> "ERROR: constraint one: table protein does not have an attribute oid"

How old is your Postgres?

IIRC, this was made to work in 7.2 or thereabouts.

Note that using OID as a foreign key is not really a good idea, because
it's problematic to dump and restore.  You'd be better off with a serial
column as primary key.

regards, tom lane

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



Re: [SQL] Time difference without intervals

2002-11-10 Thread Roberto Mello
On Fri, Nov 08, 2002 at 04:11:05PM -0500, Tom Lane wrote:
> Roberto Mello <[EMAIL PROTECTED]> writes:
> > Is there any way to make a timestamp difference operation not return an
> > interval? I'd like to get hours, minutes and seconds only, not the "1 day"
> > or whatnot.
> 
> I think your complaint is not that you get an interval, but that you
> want it displayed differently.  See to_char() ...

It was not a complaint in any way. I apologize if I came across like that.
It was an honest question.

Thanks for the replies.

-Roberto

-- 
+|Roberto Mello   -http://www.brasileiro.net/  |--+
+   Computer Science Graduate Student, Utah State University  +
+   USU Free Software & GNU/Linux Club - http://fslc.usu.edu/ +
"Apple" (c) Copyright 1767, Sir Isaac Newton.

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



Re: [SQL] Time difference without intervals

2002-11-10 Thread Tom Lane
Roberto Mello <[EMAIL PROTECTED]> writes:
> On Fri, Nov 08, 2002 at 04:11:05PM -0500, Tom Lane wrote:
>> I think your complaint is not that you get an interval, but that you
>> want it displayed differently.  See to_char() ...

> It was not a complaint in any way. I apologize if I came across like that.
> It was an honest question.

Certainly --- I perhaps came across in the wrong way by using the word
"complaint".  Maybe "gripe" or "concern" would've been better.  I was
just trying to identify exactly where the problem was.

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html