[SQL] Help creating rules/triggers/functions

2001-03-02 Thread Blaise Carrupt
Hi all ! I use PostgreSQL 7.0.2 on a HP-UX system. I would like to create a simple function and a simple trigger (or rule) that deny a delete from a table if the row is referenced in another table. I though it should look like this (from my Ingres experience... :) : create function A_del(int4

Re: [SQL] BufTableDelete: BufferLookup table corrupted

2001-03-01 Thread Blaise Carrupt
I restarted Postmaster and it works now ! Thanks. The only thing I can say about it is that I was in the middle of a transaction executed in background, using 100% CPU, and I killed the postmaster forked for my transaction (I work under HP-UX). Maybe I shouldn't do this... :) ___ B. Ca

[SQL] BufTableDelete: BufferLookup table corrupted

2001-03-01 Thread Blaise Carrupt
Hi all ! I'm working with PostgreSQL 7.0.2, and I may have a little problem : my database seems to be corrupted. When I connect to database (with psql, e.g.), I receive the message 'FATAL 1: BufTableDelete: BufferLookup table corrupted'. If I insist, I can enter the database. But then, a coup

Re: [SQL] interval query.

2001-01-31 Thread Blaise Carrupt
> Is there some way to make interval query? > > What I need is when the town's id= I want to make query > where id= OR id=[3..12] for example. I could generate bunch of OR's > like id=3 OR id=4 ... but is there some more elegant solution? > This should work : WHERE id = OR id BETW

[SQL] Convert an interval in seconds

2001-01-24 Thread Blaise Carrupt
Hi all ! I've search all the doc to find a function which would allow me to convert an interval into a number of seconds. What I get is @ 1 hour, what I would like is -3600. I'd think to something like select interval('sec', myTime) - Ingres syntax - but it doesn't work. Does somebody has an

Re: [SQL] SQL Query using time

2000-12-12 Thread Blaise Carrupt
> Is it possible to carry out the comparison in the following manner > select name from table where 00:12 is between 23:58 and 00:30 You could try something like WHERE ('00:12' BETWEEN startTime AND endTime AND startTime <= endTime) OR ('00:12' NOT BETWEEN endTime AND startTime

[SQL] Get a time from a char column

2000-10-25 Thread Blaise Carrupt
Hi ! What I would like is this : insert into tt1 (select a from tt2) where tt1.x field is a time, and tt2.a field is a char containing '10:00'. Doing that, Postgres tells me something like 'x is of type time and a of type bpchar'. That's true, but I can't find the way to cast my char field in