Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Tom Lane
Don Drake <[EMAIL PROTECTED]> writes: > On Mon, 31 Jan 2005 16:32:02 -0800 (PST), Stephan Szabo > <[EMAIL PROTECTED]> wrote: >> Actually, now that I think about it, I wonder if that's a good thing to >> use because I don't think that'll use indexes to do the search. You may >> want to do some test

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Don Drake
I'm constraining on other columns as well and it's still picking up the index. Thanks again. -Don On Mon, 31 Jan 2005 16:32:02 -0800 (PST), Stephan Szabo <[EMAIL PROTECTED]> wrote: > On Mon, 31 Jan 2005, Don Drake wrote: > > > You learn something new everyday. I've never seen that syntax befo

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Stephan Szabo
On Mon, 31 Jan 2005, Don Drake wrote: > You learn something new everyday. I've never seen that syntax before, > and it works like a charm!! Actually, now that I think about it, I wonder if that's a good thing to use because I don't think that'll use indexes to do the search. You may want to do

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Don Drake
You learn something new everyday. I've never seen that syntax before, and it works like a charm!! Thanks a ton. -Don On Mon, 31 Jan 2005 13:31:34 -0800 (PST), Stephan Szabo <[EMAIL PROTECTED]> wrote: > > On Sun, 30 Jan 2005, Don Drake wrote: > > > OK, I have a function that finds records tha

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Stephan Szabo
On Sun, 30 Jan 2005, Don Drake wrote: > OK, I have a function that finds records that changed in a set of > tables and attempts to insert them into a data warehouse. > > There's a large outer loop of candidate rows and I inspect them to see > if the values really changed before inserting. > > My

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Thomas F . O'Connell
As far as I know, you didn't post your actual table definitions (or full queries) earlier, so I'm not exactly sure what you mean. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC http://www.sitening.com/ 110 30th Avenue North, Suite 6 Nashville, TN 37203-6320 615-260-00

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Don Drake
My outer query to get the candidates has an outer join, that works just fine and I get the null OMCR_ID's. It's when I have to query the dimension table (no joins) to see if a row exists with a (sometimes) null OMCR_ID I'm forced to write 2 queries, when I think I should only have to write one. T

Re: [SQL] plpgsql functions and NULLs

2005-01-31 Thread Thomas F . O'Connell
This sounds like a perfect candidate for a LEFT OUTER JOIN. See: http://www.postgresql.org/docs/7.4/static/queries-table- expressions.html#QUERIES-FROM Yours would looks something like: SELECT * FROM ... LEFT JOIN candidate AS c ON <...>.omcr_id = c.omcr_id AND ... -tfo -- Thomas F. O'Connell Co-

[SQL] plpgsql functions and NULLs

2005-01-30 Thread Don Drake
OK, I have a function that finds records that changed in a set of tables and attempts to insert them into a data warehouse. There's a large outer loop of candidate rows and I inspect them to see if the values really changed before inserting. My problem is that when I look to see if the row exists