Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Bugs > BUG #4106: WHER...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 3703 of 3940
Post > Topic >>

BUG #4106: WHERE - clause in view works only sometimes

by kiruu@[EMAIL PROTECTED] ("Alexander Strotmann") Apr 12, 2008 at 04:39 PM

The following bug has been logged online:

Bug reference:      4106
Logged by:          Alexander Strotmann
Email address:      kiruu@[EMAIL PROTECTED]
 version: 8.2
Operating system:   Windows XP / Windows 2003 Server
Description:        WHERE - clause in view works only sometimes
Details: 

Hello,

we have this table:

CREATE TABLE rollenhistorie
(
  pnr integer NOT NULL,
  rolle character varying NOT NULL,
  seit timestamp without time zone NOT NULL,
  bis timestamp without time zone,
  CONSTRAINT rollenhistorie_pkey PRIMARY KEY (pnr, seit)
) 
WITHOUT OIDS;

and this view:

CREATE OR REPLACE VIEW benutzer_mit_rolle_vw AS 
 SELECT benutzer_ohne_alles_vw.pnr, benutzer_ohne_alles_vw.vorname,
benutzer_ohne_alles_vw.nachname, benutzer_ohne_alles_vw.nutzerkennung,
benutzer_ohne_alles_vw.passwort, benutzer_ohne_alles_vw.plz,
benutzer_ohne_alles_vw.ort, benutzer_ohne_alles_vw.strasse,
benutzer_ohne_alles_vw.hausnummer, benutzer_ohne_alles_vw.telefon_dienst,
benutzer_ohne_alles_vw.email,
benutzer_ohne_alles_vw.anzahl_tage_erinnerung,
benutzer_ohne_alles_vw.gebietsschutz, rollenhistorie.rolle,
rollenhistorie.seit, rollenhistorie.bis
   FROM benutzer_ohne_alles_vw
NATURAL JOIN rollenhistorie
  WHERE rollenhistorie.bis IS NULL;

So the view joins the upper table with another view and filters the sets
in
'rollenhistorie' by taking only the sets where 'bis' is NULL.
By questioning this view with this function:

CREATE OR REPLACE FUNCTION get_user_and_role_plpgsql()
  RETURNS SETOF benutzer_mit_rolle_vw AS
$BODY$
DECLARE 
 rec RECORD;
BEGIN
 FOR rec IN Select * from benutzer_mit_rolle_vw
 LOOP
  RETURN NEXT rec;
 END LOOP;
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE;

we get sometimes results where 'bis' is not NULL! But it is not
deterministic because in about 80% of request times the result is correct.
The work-around for us is putting the 'WHERE bis IS NULL' in the
function...

Kind regards

Alexander Strotmann

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
 




 5 Posts in Topic:
BUG #4106: WHERE - clause in view works only sometimes
kiruu@[EMAIL PROTECTED]   2008-04-12 16:39:43 
Re: BUG #4106: WHERE - clause in view works only sometimes
heikki@[EMAIL PROTECTED]   2008-04-12 20:40:36 
Re: BUG #4106: WHERE - clause in view works only sometimes
tgl@[EMAIL PROTECTED] (T  2008-04-12 16:28:50 
Re: BUG #4106: WHERE - clause in view works only sometimes
tgl@[EMAIL PROTECTED] (T  2008-04-12 20:14:41 
Re: BUG #4106: WHERE - clause in view works only sometimes
kiruu@[EMAIL PROTECTED]   2008-04-13 11:17:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 13:29:32 CDT 2008.