Re: [SQL] Delete with foreign keys

2008-02-22 Thread felix
On Sat, Feb 23, 2008 at 12:42:13PM +0530, dipesh wrote: >alter table data add constraint data_place_id_fkey FOREIGN KEY(place_id) > REFERENCES place(id) ON DELETE CASCADE ON UPDATE CASCADE; Interestingly different way of doing it. Thanks. It makes me think too :-) -- ... _._.

Re: [SQL] Delete with foreign keys

2008-02-22 Thread dipesh
[EMAIL PROTECTED] wrote: I have three tables -- CREATE TABLE name (id INT PRIMARY KEY, str VARCHAR(20)); CREATE TABLE place (id INT PRIMARY KEY, name_id INT REFERENCES name(id)); CREATE TABLE data (id INT PRIMARY KEY, place_id INT REFERENCES place(id)); I want to delete all place an

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Tom Lane
Ken Johanson <[EMAIL PROTECTED]> writes: > Here's one Mysql developer's response to adding (fixing) the > integer/bigint/tinyint types to their CAST function: > http://bugs.mysql.com/bug.php?id=34562 Hmm ... while I'm certainly not someone to defend mysql on a regular basis, I can see their poin

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Scott Marlowe
On Fri, Feb 22, 2008 at 11:03 PM, Mail Delivery Subsystem <[EMAIL PROTECTED]> wrote: > This is an automatically generated Delivery Status Notification > > Delivery to the following recipient failed permanently: > > [EMAIL PROTECTED] > To: "Dean Gibson (DB Administrator)" <[EMAIL PROTECTED]>

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Scott Marlowe
On Fri, Feb 22, 2008 at 7:39 PM, Dean Gibson (DB Administrator) <[EMAIL PROTECTED]> wrote: > So, I went with PostgreSQL. Why? From the book, it was clear that > MySQL lacked so many features of a decent SQL DB. In particular (at the > time) VIEWs and sub-selects. Note that unless someone's d

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Dean Gibson (DB Administrator)
On 2008-02-22 16:13, Scott Marlowe wrote: There's example after example of things in the mysql bug database that should make anyone considering it as a database engine cringe and walk away shaking their head. I don't understand why anyone wanting a real SQL DB would pick MySQL. Four years ago

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Scott Marlowe
On Fri, Feb 22, 2008 at 1:57 PM, Alvaro Herrera <[EMAIL PROTECTED]> wrote: > Ken Johanson wrote: > > Here's one Mysql developer's response to adding (fixing) the > > integer/bigint/tinyint types to their CAST function: > > > > http://bugs.mysql.com/bug.php?id=34562 > > So they are anal too, bu

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-22 Thread johnf
On Friday 22 February 2008 01:35:47 am Bart Degryse wrote: > Can you try this... > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) > RETURNS SETOF t_functionaries AS > $BODY$ > DECLARE > rec t_functionaries%ROWTYPE; > BEGIN > FOR rec IN ( > SELECT f.functionaryid, f.categ

Re: [SQL] SQL standards in Mysql

2008-02-22 Thread Alvaro Herrera
Ken Johanson wrote: > Here's one Mysql developer's response to adding (fixing) the > integer/bigint/tinyint types to their CAST function: > > http://bugs.mysql.com/bug.php?id=34562 So they are anal too, but in the opposite direction? -- Alvaro Herrerahttp://www.

[SQL] SQL standards in Mysql

2008-02-22 Thread Ken Johanson
Here's one Mysql developer's response to adding (fixing) the integer/bigint/tinyint types to their CAST function: http://bugs.mysql.com/bug.php?id=34562 ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropria

[SQL] Delete with foreign keys

2008-02-22 Thread felix
I have three tables -- CREATE TABLE name (id INT PRIMARY KEY, str VARCHAR(20)); CREATE TABLE place (id INT PRIMARY KEY, name_id INT REFERENCES name(id)); CREATE TABLE data (id INT PRIMARY KEY, place_id INT REFERENCES place(id)); I want to delete all place and data rows which reference

Re: [SQL] postgresql function not accepting null values inselect statement

2008-02-22 Thread Bart Degryse
Can you try this... CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) RETURNS SETOF t_functionaries AS $BODY$ DECLARE rec t_functionaries%ROWTYPE; BEGIN FOR rec IN ( SELECT f.functionaryid, f.category, f.description FROM functionaries f WHERE f.statecd IS NOT DISTI

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Richard Huxton
Jyoti Seth wrote: Hi, I have a the following procedure CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) SELECT f.functionaryid, f.category,f.description FROM functionaries f where f.statecd=p_statecd In the functionaries table statecd is a null field.

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Robins Tharakan
> > Hi, > > When you pass non-null values in p_statecd the result should work fine, > but when you pass NULL in p_statecd ... the equal operator stops to work as > you as expect it to. > > Please see this documentation: > http://www.postgresql.org/docs/8.2/interactive/functions-comparison.html > fr

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Jyoti Seth
Hi, I have a the following procedure CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer) RETURNS SETOF t_functionaries AS $BODY$ DECLARE rec t_functionaries%ROWTYPE; begin FOR rec IN SELECT f.functionaryid, f.category,f.description FROM functionaries f

Re: [SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Richard Huxton
Jyoti Seth wrote: If I pass null value as the parameter of postgresql function, which is used in the where clause of select statement is not functioning properly. Either: 1. You're talking about frooble(), in which case it's supposed to do that. or 2. You'll need to tell us what function it

[SQL] postgresql function not accepting null values in select statement

2008-02-22 Thread Jyoti Seth
Hi, If I pass null value as the parameter of postgresql function, which is used in the where clause of select statement is not functioning properly. I have also changed the value of transform_null_equals = on in the conf file and restarted postgresql. But it is still giving error. Is t