Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1568C6324E2 for ; Fri, 9 Apr 2010 14:33:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 44509-07 for ; Fri, 9 Apr 2010 17:32:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f46.google.com (mail-ww0-f46.google.com [74.125.82.46]) by mail.postgresql.org (Postfix) with ESMTP id 36CE26324A1 for ; Fri, 9 Apr 2010 14:32:53 -0300 (ADT) Received: by wwi17 with SMTP id 17so1017596wwi.19 for ; Fri, 09 Apr 2010 10:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=M+b6rHk2vQxFrxqczVEtwyh95rFYjMQ/xqK+nTgbQrU=; b=NZMREfjSmf53TfK5X8CE45fDM1J10T0KbfjnaFOBLM5G9UHA3KjXCoYyWLPinNqkgp lDvI1ER4BCOvIGm4ZyjKadBEbibHwfiVJ2czG4Jm6H3qksPYs3H2BxQmxn/XYBEn4qjD VvFzEvZyBNXaTrwj/OlFhNLfIdUB2K7LwEA6E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Ez41j1u2eYFUwvFdmP2xiGqe7Snvs39XW3jEZgRsxaNq/c/5Leg/UxB0NcRhwgm3Zh vtzpJBOfd1E6pgQNiy6Ng8EQzl+x2CmwvOnP77qLRF9cZbDNrI7rO8Zo/t2IkYm4eFLZ PorSD1XBw6hEm+70GQR9SoB0JS0QL0S16zYhQ= MIME-Version: 1.0 Received: by 10.216.233.151 with HTTP; Fri, 9 Apr 2010 10:32:51 -0700 (PDT) In-Reply-To: <201004091018.37965.johnf@jfcomputer.com> References: <201004091018.37965.johnf@jfcomputer.com> Date: Fri, 9 Apr 2010 19:32:51 +0200 Received: by 10.216.87.79 with SMTP id x57mr197236wee.83.1270834371729; Fri, 09 Apr 2010 10:32:51 -0700 (PDT) Message-ID: Subject: Re: understanding select into From: Pavel Stehule To: John Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.179 tagged_above=-10 required=5 tests=AWL=-1.179 X-Spam-Level: X-Archive-Number: 201004/39 X-Sequence-Number: 33966 Hello 2010/4/9 John : > Hi, > I am reviewing a function written by some xTuple guys. =C2=A0What is inte= resting > about it is it uses the "INTO" statement like > > select something into _p from sometable where somecriteria. > > The function contiunes and uses the data retreived > _p.somefield_name > > And then the function ends. > > > Ok my question: > > I also thought the select "into" created a real table. =C2=A0But after ru= nning the > function the table does not exist. =C2=A0I see no where that a 'drop' is = issued. > In fact the function uses lot's of select into's like (_test, _r, etc..).= =C2=A0So > would some kind soul explain what is happening. > _p is record variable. See some lines before. There will be DECLARE part DECLARE p RECORD; There is plpgsql's SELECT INTO and SQL's SELECT INTO with little bit different syntax. First - target is list of variables or record variable, second - target is table. > Could it be that "_p" is drop automaticly when the function ends? =C2=A0S= omething > to do with scope. > _p is just variable regards Pavel Stehule > Could it have something to do with the fact the function returns only an > integer? =C2=A0And that causes the table to be drop. > > As you can see I'm lost here! > > > Johnf > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql >