pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13880: Different procedures in same SQL
2+ messages / 2 participants
[nested] [flat]

* BUG #13880: Different procedures in same SQL
@ 2016-01-21 16:53 victor.evangelista@caixa.gov.br
  2016-01-22 05:02 ` Re: BUG #13880: Different procedures in same SQL David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: victor.evangelista@caixa.gov.br @ 2016-01-21 16:53 UTC (permalink / raw)
  To: pgsql-bugs

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 <table> (namecolum1, namecolum2, namecolum3, namecolum4) 
select distinct 'value1', 'value2', 'value3', 'value4'
from <table> where not exists (select 1 from <table> 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #13880: Different procedures in same SQL
  2016-01-21 16:53 BUG #13880: Different procedures in same SQL victor.evangelista@caixa.gov.br
@ 2016-01-22 05:02 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2016-01-22 05:02 UTC (permalink / raw)
  To: victor.evangelista@caixa.gov.br; +Cc: pgsql-bugs

On Thu, Jan 21, 2016 at 9:53 AM, <victor.evangelista@caixa.gov.br> 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 <table> (namecolum1, namecolum2, namecolum3, namecolum4)
> select distinct 'value1', 'value2', 'value3', 'value4'
> from <table> where not exists (select 1 from <table> 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.
>
>
​Yeah, if "<table>" is empty then a query having "<table>" in its FROM
clause will return zero records.  Period.  That fact that you add "DISTINCT
'literal' AS col" won't change that.

David J.​

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-01-22 05:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-21 16:53 BUG #13880: Different procedures in same SQL victor.evangelista@caixa.gov.br
2016-01-22 05:02 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox