[Fwd: Re: I guess I'm missing something here WRT FOUND] - Mailing list pgsql-general

From Ralph Smith
Subject [Fwd: Re: I guess I'm missing something here WRT FOUND]
Date
Msg-id 4CD99CD0.1060900@10kinfo.com
Whole thread Raw
List 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
_________________________


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Why facebook used mysql ?
Next
From: Tom Lane
Date:
Subject: Re: I guess I'm missing something here WRT FOUND