From victor.evangelista@caixa.gov.br Fri Jan 22 04:06:51 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aMSzr-0000aR-FN for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Jan 2016 04:06:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aMSzr-0003mB-2C for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Jan 2016 04:06:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aMIUy-0000fP-NR for pgsql-bugs@postgresql.org; Thu, 21 Jan 2016 16:54:16 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aMIUn-0004eF-1Z for pgsql-bugs@postgresql.org; Thu, 21 Jan 2016 16:54:09 +0000 MIME-Version: 1.0 Subject: BUG #13880: Different procedures in same SQL To: pgsql-bugs@postgresql.org From: victor.evangelista@caixa.gov.br Date: Thu, 21 Jan 2016 16:53:10 +0000 Message-ID: <20160121165310.2736.59053@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13880 Logged by: Victor Neves Email address: victor.evangelista@caixa.gov.br PostgreSQL version: 9.1.9 Operating system: RedHat 4.4.7 x64 Description: I found a different procedures in same SQL, in postgres 9.1.9. I create a table, but i dont insert any data, after execute insert into (namecolum1, namecolum2, namecolum3, namecolum4) select distinct 'value1', 'value2', 'value3', 'value4' from
where not exists (select 1 from
sis where sis.namecolum2='value2' ) Postgres says: "Query returned successfully: 0 rows affected, 1 ms execution time." But if I insert any data in the table and execute the SQL again, the insert works fine! If I truncate the table and execute de SQL, postgres says "0 rows affected" again. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs From david.g.johnston@gmail.com Fri Jan 22 05:03:29 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aMTsf-0002so-Dt for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Jan 2016 05:03:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aMTse-00037G-Nd for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Jan 2016 05:03:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aMTs1-0002Py-K5 for pgsql-bugs@postgresql.org; Fri, 22 Jan 2016 05:02:49 +0000 Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aMTrw-0002j7-DB for pgsql-bugs@postgresql.org; Fri, 22 Jan 2016 05:02:49 +0000 Received: by mail-ig0-x234.google.com with SMTP id mw1so47957787igb.1 for ; Thu, 21 Jan 2016 21:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=dmN7900rg+lta9CeS48jIrr+wb0nEW8Qzd3ds9ieZS4=; b=sRMI3/x4Cd9DZd2uJlIIoZDTp5EWRKbSbKju1xIykqqptbiYs3IYhVGTCbFpOccHRs f+eTTA8lEk7ZUO8Dlreu23Bt/vXSxJhituP1SulHZluwQ9vSIqEXQvd9ZiI+7en3jc/j ONeL1e5kVPbSvXkchM4hl+uoFqdE07sbdQLfbjRcutEZA5DsNowhCBDXH+1RO2YC/bX1 4VPpmq/m77eY1n+sTUVI4nTHB04FxZ7paKGhq3H7AAgdGy+GB07NcG7KRT1doIycBxsJ +4OTV089nZ67YZOfJQmFEU3xsy39xTnwBl1TzTfEwD6v9+HF31Ljm3p69rfw0seSApre Yykg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=dmN7900rg+lta9CeS48jIrr+wb0nEW8Qzd3ds9ieZS4=; b=ZvAx418IkgYbTJCI1rHT2v5jpR6bZaTHbaeP/deWsRf9W2cxDr+taHZlycvDvCCIlU N6P3Qc65tTai1RIaDyOmlehh4D7ybbGhNNf/caopES9GaYDeO1B0QoUWClBLLSIZ0Qo4 /ySL+DsfTQCNs67h2c4umnSb7ciH9tJIX+nG/oCijTGLdBquNTL6bjUjYe4oqlXS6sZD Wc8CpwjdHrhvEeS6Xb0Ra7f/RGKX+BNRI1qGySYynttrOX7TpH6w17deEGwduec4SuO0 RXkvI4mdr/fiqLvbWCY6O6p4z/YkZ/kyXYOG3/aHhlX1ODhOVcgdctcLV96L+xNGwZt/ PMfw== X-Gm-Message-State: AG10YOT4TWp0+0bDRsdfbqwf4Aahv75DrZ4ZrGiW62vVaxoxKZM39N/CyezZyChDodAv8Mt0HKfYa9htAjGdAg== MIME-Version: 1.0 X-Received: by 10.50.143.100 with SMTP id sd4mr333771igb.93.1453438961681; Thu, 21 Jan 2016 21:02:41 -0800 (PST) Received: by 10.36.153.196 with HTTP; Thu, 21 Jan 2016 21:02:41 -0800 (PST) In-Reply-To: <20160121165310.2736.59053@wrigleys.postgresql.org> References: <20160121165310.2736.59053@wrigleys.postgresql.org> Date: Thu, 21 Jan 2016 22:02:41 -0700 Message-ID: Subject: Re: BUG #13880: Different procedures in same SQL From: "David G. Johnston" To: victor.evangelista@caixa.gov.br Cc: "pgsql-bugs@postgresql.org" Content-Type: multipart/alternative; boundary=001a1134b4ca038f140529e52168 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --001a1134b4ca038f140529e52168 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Jan 21, 2016 at 9:53 AM, wrote: > The following bug has been logged on the website: > > Bug reference: 13880 > Logged by: Victor Neves > Email address: victor.evangelista@caixa.gov.br > PostgreSQL version: 9.1.9 > Operating system: RedHat 4.4.7 x64 > Description: > > I found a different procedures in same SQL, in postgres 9.1.9. > > I create a table, but i dont insert any data, after execute > > insert into
(namecolum1, namecolum2, namecolum3, namecolum4) > select distinct 'value1', 'value2', 'value3', 'value4' > from
where not exists (select 1 from
sis where > sis.namecolum2=3D'value2' ) > > Postgres says: "Query returned successfully: 0 rows affected, 1 ms > execution > time." > > But if I insert any data in the table and execute the SQL again, the inse= rt > works fine! > > If I truncate the table and execute de SQL, postgres says "0 rows affecte= d" > again. > > =E2=80=8BYeah, if "
" is empty then a query having "
" in its F= ROM clause will return zero records. Period. That fact that you add "DISTINCT 'literal' AS col" won't change that. David J.=E2=80=8B --001a1134b4ca038f140529e52168 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Thu, Ja= n 21, 2016 at 9:53 AM, <victor.evangelista@caixa.gov.br> wrote:
The following= bug has been logged on the website:

Bug reference:=C2=A0 =C2=A0 =C2=A0 13880
Logged by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Victor Neves
Email address:=C2=A0 =C2=A0 =C2=A0 victor.evangelista@caixa.gov.br
PostgreSQL version: 9.1.9
Operating system:=C2=A0 =C2=A0RedHat 4.4.7 x64
Description:

I found a different procedures in same SQL, in postgres 9.1.9.

I create a table, but i dont insert any data, after execute

insert into <table> (namecolum1, namecolum2, namecolum3, namecolum4)<= br> select distinct 'value1', 'value2', 'value3', '= value4'
from <table> where not exists (select 1 from <table> sis where<= br> sis.namecolum2=3D'value2' )

Postgres says: "Query returned successfully: 0 rows affected, 1 ms exe= cution
time."

But if I insert any data in the table and execute the SQL again, the insert=
works fine!

If I truncate the table and execute de SQL, postgres says "0 rows affe= cted"
again.


=E2=80=8BYeah, if "<table&= gt;" is empty then a query having "<table>" in its FRO= M clause will return zero records.=C2=A0 Period.=C2=A0 That fact that you a= dd "DISTINCT 'literal' AS col" won't change that.

David= J.=E2=80=8B
=C2=A0
--001a1134b4ca038f140529e52168--