Re: EXCEPT call not working

From: Charles Tassell <ctassell(at)isn(dot)net>
To: chris mutchler <davron(at)leibnizcreations(dot)com>, pgsql-general(at)hub(dot)org
Subject: Re: EXCEPT call not working
Date: 2000-09-08 18:32:18
Message-ID: 4.3.2.7.2.20000908153120.04818bd0@mailer.isn.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

EXCEPT doesn't work well in PostGres. Try replacing EXCEPT with NOT IN (...)

At 06:00 PM 9/7/00, chris mutchler wrote:
>I have a perl script that interacts with my postgresql server through the
>DBI module. When, I send my query to the server it will work fine with
>the following:
>
>$sth = $dbh->prepare("
> SELECT p.ids_name, m.start_time, m.end_time
> FROM mail_schedule m, personnel p
> WHERE p.ids_int = m.ids_int AND
> m.dow = $weekday
> UNION
> SELECT p.ids_name, c.on_start, c.on_end
> FROM mail_changes c, personnel p
> WHERE p.ids_int = c.ids_int
>");
>
>But as soon as I place the EXCEPT call in there it stops working and
>doesn't return any values:
>
>$sth = $dbh->prepare("
> SELECT p.ids_name, m.start_time, m.end_time
> FROM mail_schedule m, personnel p
> WHERE p.ids_int = m.ids_int AND
> m.dow = $weekday
> UNION
> SELECT p.ids_name, c.on_start, c.on_end
> FROM mail_changes c, personnel p
> WHERE p.ids_int = c.ids_int
> EXCEPT
> SELECT p.ids_name, c.on_start, c.on_end
> FROM mail_changes c, personnel p
> WHERE p.ids_int = c.ids_int
> AND c.on_start = 0
> AND c.on_end = 0
>");
>
>Does anyone have any suggestions as to why my EXCEPT call isn't working?
>If you see some drastic or subtle syntax error let me know. I have never
>used EXCEPT before, and am not having much luck. thanks.
>
>Chris Mutchler
>davron(at)leibnizcreations(dot)com

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2000-09-08 18:56:26 log message
Previous Message Dean Browett 2000-09-08 18:13:01 failed compile on alpha using postgresql7.0.2