Re: I guess I'm missing something here WRT FOUND

From: Ralph Smith <rsmith(at)10kinfo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: I guess I'm missing something here WRT FOUND
Date: 2010-11-09 18:58:28
Message-ID: 4CD999D4.6080402@10kinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Yeah your right Alban, that looks bad, but it was an artifact of
'try-this, try-this, no, try-this'.<br>
<br>
The table is empty, and unfortunately remains that way; nothing gets
inserted.<br>
I tried other variations, however FOUND just isn't behaving as I would
think.<br>
<br>
-----------------------------------------------<br>
OUTPUT SNIPPET:<br>
NOTICE:&nbsp; SQL cmd is = SELECT COUNT(*) FROM zbus_tokens WHERE token =
PARKING<br>
NOTICE:&nbsp; Row = 10,&nbsp;&nbsp; Skipped INSERT Count = 32,&nbsp;&nbsp; Word2 = PARING<br>
NOTICE:&nbsp; SQL cmd is = SELECT COUNT(*) FROM zbus_tokens WHERE token =
COLLEEN<br>
NOTICE:&nbsp; Row = 11,&nbsp;&nbsp; Skipped INSERT Count = 33,&nbsp;&nbsp; Word2 = COLLEEN<br>
<br>
</tt><tt>-----------------------------------------------</tt><br>
<tt>&nbsp;&nbsp;&nbsp; Alban Hertroys wrote:</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 9 Nov 2010, at 5:11, Ralph Smith wrote:</tt><br>
<tt></tt><br>
<!----><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Why is FOUND 'finding' and hence avoiding an INSERT?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp; &nbsp; Not really sure what your point is (don't have time to look
closely), but...<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; PERFORM Rnotice1(1,''SQL cmd is'',''SELECT COUNT(*) FROM
zbus_tokens WHERE token = ''||Word2::varchar) ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; PERFORM (SELECT COUNT(*) FROM zbus_tokens WHERE token =
Word2) ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; IF NOT FOUND THEN</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; PERFORM RNotice1(1,''value'',Word2) ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; INSERT INTO zbus_tokens (token) values(Word2); </tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; J=J+1 ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; IF J % 100 = 0 THEN</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; PERFORM Rnotice2(1,''Row'',I,''Insert Count'',J) ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; END IF ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; ELSE</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; K=K+1 ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; PERFORM RNotice2(1,''Row'',I,''Skipped INSERT Count'',K) ;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; END IF ;<br>
&nbsp;&nbsp; You just connected this ELSE block to the IF statement it was nested
inside.<br>
&nbsp;&nbsp; You probably need to comment out the rest of this ELSE block as well.<br>
<br>
<br>
</tt><tt> &nbsp; Alban Hertroys<br>
<br>
</tt><tt>--<br>
</tt><tt>Screwing up is an excellent way to attach something to the
ceiling.<br>
(Assuming you're not turning the screw driver the wrong way.)<br>
<br>
</tt><tt><br>
-- <br>
Ralph<br>
_________________________</tt>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 3.0 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2010-11-09 18:58:56 Re: Why facebook used mysql ?
Previous Message Igor Neyman 2010-11-09 18:51:36 Re: REINDEX requirement?