[Fwd: 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: [Fwd: Re: I guess I'm missing something here WRT FOUND]
Date: 2010-11-09 19:11:12
Message-ID: 4CD99CD0.1060900@10kinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yeah your right Alban, that looks bad, but it was an artifact of
'try-this, try-this, no, try-this'.

The table is empty, and unfortunately remains that way; nothing gets
inserted.
I tried other variations, however FOUND just isn't behaving as I would
think.

-----------------------------------------------
OUTPUT SNIPPET:
NOTICE: SQL cmd is = SELECT COUNT(*) FROM zbus_tokens WHERE token = PARKING
NOTICE: Row = 10, Skipped INSERT Count = 32, Word2 = PARING
NOTICE: SQL cmd is = SELECT COUNT(*) FROM zbus_tokens WHERE token = COLLEEN
NOTICE: Row = 11, Skipped INSERT Count = 33, Word2 = COLLEEN

-----------------------------------------------
Alban Hertroys wrote:
On 9 Nov 2010, at 5:11, Ralph Smith wrote:

Why is FOUND 'finding' and hence avoiding an INSERT?

Not really sure what your point is (don't have time to look
closely), but...

PERFORM Rnotice1(1,''SQL cmd is'',''SELECT COUNT(*) FROM
zbus_tokens WHERE token = ''||Word2::varchar) ;
PERFORM (SELECT COUNT(*) FROM zbus_tokens WHERE token = Word2) ;
IF NOT FOUND THEN
PERFORM RNotice1(1,''value'',Word2) ;
INSERT INTO zbus_tokens (token) values(Word2);
J=J+1 ;
IF J % 100 = 0 THEN
PERFORM Rnotice2(1,''Row'',I,''Insert Count'',J) ;
END IF ;
ELSE
K=K+1 ;
PERFORM RNotice2(1,''Row'',I,''Skipped INSERT Count'',K) ;
END IF ;
You just connected this ELSE block to the IF statement it was nested
inside.
You probably need to comment out the rest of this ELSE block as well.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.
(Assuming you're not turning the screw driver the wrong way.)

--
Ralph
_________________________

--

Ralph
_________________________

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-11-09 19:21:42 Re: I guess I'm missing something here WRT FOUND
Previous Message Scott Marlowe 2010-11-09 18:58:56 Re: Why facebook used mysql ?