Re: [SQL] Foreign Unique Constraint

2007-03-28 Thread Peter Eisentraut
Am Mittwoch, 28. März 2007 00:17 schrieb Phillip Smith: Perhaps this...? It would work, but depending how many rows are in the table, it could become incredibly slow. ALTER TABLE table1 ADD CHECK (extension NOT IN (SELECT extension FROM table2)); Subqueries are not allowed in check

Re: [SQL] Regular Expressions [progress]

2007-03-28 Thread ezequias
Richards and List, Now I find out the 'similar to' statement where I can do such search, but I must still parse all substrings. Here is my stage: Select * from myAddressTable where address similar to ('%(ELMO|ST.|258)%') But I still need to Separete all strings. Could someone help me in

Re: [SQL] Foreign Unique Constraint

2007-03-28 Thread Jon Horsman
Subqueries are not allowed in check constraints. I hadn't tried this yet but i'm sure i would have figured this out quickly then =) Thanks, Jon ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Regular Expressions [progress]

2007-03-28 Thread Richard Broersma Jr
Select * from myAddressTable where address similar to ('%(ELMO|ST.|258)%') But I still need to Separete all strings. What is it that you are trying to achieve? What string would you like to seperate? Regards, Richard Broersma Jr. ---(end of

[SQL] union with count?

2007-03-28 Thread Gerardo Herzig
Hi dudes, i have the following question i have 2 tables with the same format, and i want to know if is there a possibility of using some sort of count(*) for achieving this result: select a from table1 where (condition) union select a from table2 where (condition), count(a) group by a The

Re: [SQL] union with count?

2007-03-28 Thread A. Kretschmer
am Wed, dem 28.03.2007, um 11:04:29 -0300 mailte Gerardo Herzig folgendes: Hi dudes, i have the following question i have 2 tables with the same format, and i want to know if is there a possibility of using some sort of count(*) for achieving this result: select a from table1 where

Re: [SQL] union with count?

2007-03-28 Thread Gerardo Herzig
Thanks! But now i have another problem related with count(): select page_id, word, word_position, count(page_id) from (select * from search_word('word1', 'table1') union search_word('word2', 'table2')) foo group by page_id; and gives me foo.word must appear in GROUP clause or be used in an

[SQL] Rules with sequence columns

2007-03-28 Thread Ray Madigan
I have the following situation that I would appreciate your input on: I have a table with a column that I use to uniquely identify its rows. The table also has a rule on insert that stores the row identifier into another table for reference at some other point. The table is defined as CREATE

Re: [SQL] Rules with sequence columns

2007-03-28 Thread Tom Lane
Ray Madigan [EMAIL PROTECTED] writes: Does anyone have any suggestion? Use a trigger to propagate the data to the other table. You can't make this work reliably with a rule, because rules are macros and hence inherently subject to double-evaluation problems when dealing with volatile functions.

Re: [SQL] union with count?

2007-03-28 Thread Andreas Kretschmer
Gerardo Herzig [EMAIL PROTECTED] schrieb: Thanks! But now i have another problem related with count(): select page_id, word, word_position, count(page_id) from (select * from search_word('word1', 'table1') union search_word('word2', 'table2')) foo group by page_id; and gives me

[SQL] How too select different views using a IF/THEN/ELSE procedure ?

2007-03-28 Thread Wilkinson, Jim
Below is a select statement that select incidents by month. I need a function or a method to select differents views that will show the Month columns is a different order. Say Apr - Mar for a fiscal year. I need to do something like an if/then/else statement that selects the correct view to

[SQL] Track query status

2007-03-28 Thread Sumeet
Hi all, I have ran a update query on a dataset which has about 48 million records and the query is already running for the third dayim so tempted to the kill this query nowis there a way to know if the query is running?? here is the query i've ran UPDATE ma SET

Re: [SQL] Track query status

2007-03-28 Thread Andrew Sullivan
On Wed, Mar 28, 2007 at 04:59:24PM -0400, Sumeet wrote: Hi all, I have ran a update query on a dataset which has about 48 million records and the query is already running for the third dayim so tempted to the kill this query nowis there a way to know if the query is running?? here

Re: [SQL] Foreign Unique Constraint

2007-03-28 Thread Phillip Smith
Is that an 8.2 thing? I'm sure I've done it before, probably in 8.1 Maybe it was a trigger I did it in - I can't remember what I had for breakfast, let alone a slow sub-query I did months ago :P Cheers, ~p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of

[SQL] SELECT INSTEAD

2007-03-28 Thread Phillip Smith
Hi all, I'm trying to create a view of the query below, but I'm being barked at about rules on SELECT must have action INSTEAD SELECT. I don't have any rules in my database, and I don't know how this query is trying to create one. The query does work if I just run it interactively. Any help

Re: [SQL] SELECT INSTEAD

2007-03-28 Thread Michael Fuhr
On Thu, Mar 29, 2007 at 03:35:52PM +1000, Phillip Smith wrote: I'm trying to create a view of the query below, but I'm being barked at about rules on SELECT must have action INSTEAD SELECT. I don't have any rules in my database, and I don't know how this query is trying to create one.