[SQL] reinitialise serial counter

2000-11-07 Thread Indraneel Majumdar
Hi, I have a table create table test (id serial, name text); after inserting values and doing delete from test if I try to insert values again, the id starts from where it left off previously. How can I get the serial counter to restart from 1 ? is it anything to do with setval(). How to use th

RE: [SQL] reinitialise serial counter

2000-11-07 Thread Edmar Wiggers
> after inserting values and doing delete from test if I try to insert > values again, the id starts from where it left off previously. How can I > get the serial counter to restart from 1 ? is it anything to do with > setval(). How to use the setval? The serial value is implemented using a seque

[SQL] Trouble Converting Dates

2000-11-07 Thread Kate Collins
Hi I am running postgres 7.02 on Linux and I am having trouble converting a character string to a date using the "to_date" function. For example: select to_char( to_date( '001112', 'YYMMDD'), 'MMDD'); to_char -- 1112 In other words it is defaulting to the year 0 (actually ye

[SQL] Cascading a pseudo-delete?

2000-11-07 Thread Brian Powell
Greetings, for our database, we keep everything--deleting nothing; however, to the client side, it should appear deleted. We do this via a status_cd for each record. If the status_cd is for 'deleted' then that item is not shown to the client-side. Anyhow, my question is that we also use foreign

[SQL] Display of RI triggers

2000-11-07 Thread Larry Rosenman
Is there a NICE way to display Referential integrity triggers? I know about select * from pg_trigger;, but that output is, err, ugly... (7.0.2, but I suspect it's the same in 7.1devel). -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 (voice) Internet:

[SQL] how to index a numeric(12,2) column?

2000-11-07 Thread Forest Wilkinson
I'd like to create an index on a column whose type is NUMERIC(12,2). There appears to be no default operator class for the numeric type. What class should I use instead? My guess is that something like this might work: CREATE INDEX foo_idx on foo (bar int8_ops); Will that work properly? Will

Re: [SQL] how to index a numeric(12,2) column?

2000-11-07 Thread Tom Lane
Forest Wilkinson <[EMAIL PROTECTED]> writes: > I'd like to create an index on a column whose type is NUMERIC(12,2). > There appears to be no default operator class for the numeric type. Uh, what version are you using? Works fine for me in 7.0.2. regards, tom lane