Re: [SQL] CREATE RULE ignored, what did I do wrong

2004-09-10 Thread Tom Lane
[EMAIL PROTECTED] writes: > Foreign-key constraints: > "$1" FOREIGN KEY (smoothing_id) REFERENCES smoothing_algorithm(smoothing_id) ON > UPDATE CASCADE ON DELETE CASCADE > Rules: > del_smoothed_rank_episode AS ON DELETE TO smoothed_rank_episode > WHERE (NOT old.is_deleted) DO INSTEAD ...

Re: [SQL] Using UPDATE FROM

2004-09-10 Thread Tom Lane
Collin Peters <[EMAIL PROTECTED]> writes: > Here is the UPDATE statement: > UPDATE programactivitysets SET repsvalue = reps_actual > FROM workouts w, workoutactivities wa, workoutactivitysets was, > programactivities pa, programactivitysets pas > WHERE wa.workout_id = w.workout_id > AND was.worko

Re: [SQL] [GENERAL] PL/pgSQL Function Problem

2004-09-10 Thread Tom Lane
the inquirer <[EMAIL PROTECTED]> writes: > I am trying to create a function that creates a user > and adds a row to a table. It produces no warnings or > errors when I create the function but when I attempt > to execute it I get a syntax error. I do not > understand why this is happening. > CREA

Re: [SQL] HOW TO HANDLE ZEROS IN DATE FIELD?

2004-09-10 Thread Michael Glaesemann
On Sep 3, 2004, at 11:36 PM, James M Doherty wrote: I have a project that is taking input from another system. I have certain columns defined as 'Date' Columns. On input I will get '00' in this field which causes the insert to fail. I have read the docs on default and it is unclear to me if

[SQL] CREATE RULE ignored, what did I do wrong

2004-09-10 Thread andrew
OK, below is the dump of the table definition. Several other tables reference this and have ON DELETE CASCADE. In this table there is a rule for ON DELETE. The WHERE clause (NOT old.is_deleted) should always be the case, as the field is FALSE for all existing entries (checked). The cascading de

[SQL] Using UPDATE FROM

2004-09-10 Thread Collin Peters
I have a sql query which hits 5 database tables. I'll cut a bit out of the results and just show the important values reps_goal reps_actual repsvalue 10 10 1 33 5 1 10 12 1 10 12 1

[SQL] PL/pgSQL Function Problem

2004-09-10 Thread the inquirer
I am trying to create a function that creates a user and adds a row to a table. It produces no warnings or errors when I create the function but when I attempt to execute it I get a syntax error. I do not understand why this is happening. Any help would be greatly appreciated. SELECT create_aut

[SQL] SQL99 "with recursive" question

2004-09-10 Thread Thomas Wegner
Hello, i think i am to stupid to use the "with recursive" SQL! I have a table: create table tree ( id_tree integer, parent_id integer ... ); In PostgreSQL i use the great connectby() function and in Oracle i simple use select * from tree start with id_tree = 0 connect by parent_id=prior id_

[SQL] HOW TO HANDLE ZEROS IN DATE FIELD?

2004-09-10 Thread James M Doherty
I have a project that is taking input from another system. I have certain columns defined as 'Date' Columns. On input I will get '00' in this field which causes the insert to fail. I have read the docs on default and it is unclear to me if this will work. Does anyone have experience in solvin

Re: [SQL] aggregate function stddev

2004-09-10 Thread Bruce Momjian
Is this a TODO? --- Josh Berkus wrote: > Kemin, > > > Just noticed that the postgres stddev is the stddev_sample formula. > > There are two different ways to calculate this value. > > Their difference is very small with lar

Re: [SQL] Isnumeric function?

2004-09-10 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > Greg Stark <[EMAIL PROTECTED]> writes: > > That's all well and good. But when I tried to make a version of your > > situation that used a function I found it doesn't work so well with > > functional indexes: > > ... > > I can't figure out why this is happenin

Re: [SQL] Isnumeric function?

2004-09-10 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > That's all well and good. But when I tried to make a version of your > situation that used a function I found it doesn't work so well with > functional indexes: > ... > I can't figure out why this is happening. You're using 7.3 or older?

Re: [SQL] Isnumeric function?

2004-09-10 Thread Greg Stark
Greg Stark <[EMAIL PROTECTED]> writes: > Theo Galanakis <[EMAIL PROTECTED]> writes: > > > I created the Index you specified, however it chooses to run a seq scan on > > the column rather than a Index scan. How can you force it to use that > > Index.. > > > > CREATE INDEX idx_content_numeric ON b