Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread David Johnston
Tom Lane-2 wrote > Stephen Frost < > sfrost@ > > writes: >> * Moshe Jacobson ( > moshe@ > ) wrote: >>> Any PG committers who can change this in 9.3? > >> It will certainly not be changed for 9.3. > > IMO, if we do anything about this at all, it should be to document the > "=" option not remov

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread Pavel Stehule
2013/6/1 Tom Lane : > Stephen Frost writes: >> * Moshe Jacobson (mo...@neadwerx.com) wrote: >>> Any PG committers who can change this in 9.3? > >> It will certainly not be changed for 9.3. > > IMO, if we do anything about this at all, it should be to document the > "=" option not remove it. If we

Re: [GENERAL] Strange behavior of "=" as assignment operator

2013-05-31 Thread Tom Lane
Stephen Frost writes: > * Moshe Jacobson (mo...@neadwerx.com) wrote: >> Any PG committers who can change this in 9.3? > It will certainly not be changed for 9.3. IMO, if we do anything about this at all, it should be to document the "=" option not remove it. If we change it, the squawks from pe

Re: [GENERAL] What are ExecSeqMarkPos and ExecSeqRestrPos used for

2013-05-31 Thread Tom Lane
Stephen Frost writes: > * DT (kurt...@hotmail.com) wrote: >> I'm reading code of nodeSeqscan, and was confused with ExecSeqMarkPos and >> ExecSeqRestrPos. They are only called by ExecMergeJoin. Could merge join use >> a plain seqscan as outer/inner plan? If not, what are they used for? > ExecSeqM

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Bosco Rama
On 05/31/13 16:27, David Salisbury wrote: > > It would seem related to the above to me, but apparently it's not. > --- > According to the standard, the column-list syntax should allow a list of > columns to be assigned from a single row-valued expression, > such as a sub-select: >

Re: [GENERAL] Insert with query

2013-05-31 Thread Adrian Klaver
On 05/31/2013 08:15 AM, Kevin Grittner wrote: Adrian Klaver wrote: On 05/31/2013 06:32 AM, Kevin Grittner wrote: But why? The OP specified FOR EACH ROW in the trigger statement. Hmm. I went to the SQL spec, and the behavior expected by Juliano seems to be what it mandated by the spec. To

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
On 5/31/13 4:45 PM, Bosco Rama wrote: On 05/31/13 15:33, David Salisbury wrote: And without trying too much ;), I'll bet there is no way to do this in SQL proper. i.e. I can't correlate an update with a select stmt, as in a correlated sub-query sort of way. So for this to work I would ind

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Bosco Rama
On 05/31/13 15:33, David Salisbury wrote: > > And without trying too much ;), I'll bet there is no way to do this in SQL > proper. i.e. > I can't correlate an update with a select stmt, as in a correlated sub-query > sort of way. > So for this to work I would indeed need to write a function tha

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
On 5/31/13 4:21 PM, Jeff Janes wrote: On Fri, May 31, 2013 at 2:37 PM, David Salisbury mailto:salisb...@globe.gov>> wrote: I would think this would be possible. I'm on 9.0.8 I have a reference between two tables, and want to populate a field in one table with a value that's in

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Jeff Janes
On Fri, May 31, 2013 at 2:37 PM, David Salisbury wrote: > > I would think this would be possible. I'm on 9.0.8 > > I have a reference between two tables, and want to populate a field in one > table > with a value that's in the referenced table ( based on the FK reference of > course ). > > with r

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Victor Yegorov
2013/6/1 David Salisbury > I would think this would be possible. I'm on 9.0.8 > Data-Modifying CTEs are available since 9.1: http://www.depesz.com/2011/03/16/waiting-for-9-1-writable-cte/ Please note, that CTE acts as an optimization fence, therefore you might experience query slowdown. --

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Bosco Rama
On 05/31/13 14:37, David Salisbury wrote: > > I would think this would be possible. I'm on 9.0.8 IIRC, updatable CTE's don't appear until 9.1.x HTH Bosco. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/ma

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 7:37 AM, David Salisbury wrote: > > I would think this would be possible. I'm on 9.0.8 > > I have a reference between two tables, and want to populate a field in one > table > with a value that's in the referenced table ( based on the FK reference of > course ). > > with ro

[GENERAL] Using a CTE for an update

2013-05-31 Thread David Salisbury
I would think this would be possible. I'm on 9.0.8 I have a reference between two tables, and want to populate a field in one table with a value that's in the referenced table ( based on the FK reference of course ). with row as ( select my.atmos_site_id, my.stationid from my_stations my, at

Re: [GENERAL] [PERFORM] Evaluating query performance with caching in PostgreSQL 9.1.6

2013-05-31 Thread Marti Raudsepp
On Fri, May 31, 2013 at 7:32 PM, wrote: > 1.) Is there any way to clear the cache so that we can ensure that when we > run "explain analyze" on a query and make some minor adjustments to that > query and re-execute, the plan is not cached. PostgreSQL doesn't cache query plans if you do a normal

[GENERAL] Evaluating query performance with caching in PostgreSQL 9.1.6

2013-05-31 Thread fburgess
Two questions Please1.) Is there any way to clear the cache so that we can ensure that when we run "explain analyze" on a query and make some minor adjustments to that query and re-execute, the plan is not cached. Since the cached plan returns runtimes that are much lower than the initial execution

Re: [GENERAL] Insert with query

2013-05-31 Thread Kevin Grittner
Adrian Klaver wrote: > On 05/31/2013 06:32 AM, Kevin Grittner wrote: >> Juliano Amaral Chaves wrote: >> >>> By doing insert into a table using a query, it seems that all >>> records of consultation were included bypassing the AFTER INSERT >>> triggers and as few as after all the records already i

Re: [GENERAL] Insert with query

2013-05-31 Thread Adrian Klaver
On 05/31/2013 06:32 AM, Kevin Grittner wrote: Juliano Amaral Chaves wrote: By doing insert into a table using a query, it seems that all records of consultation were included bypassing the AFTER INSERT triggers and as few as after all the records already included, the TRIGGER is fired for each

Re: [GENERAL] Foreign Data Wrapper out of memory

2013-05-31 Thread Albe Laurenz
Adeelusman wrote: > i have recently started work with PostgreSQL. Here is my question! > i have a table in oracle and i want to insert all record in PostgreSQL, For > this i'm using Foreign Data Wrapper for oracle. it work fine with small set > of data but as i tried to get large table query got f

Re: [GENERAL] Insert with query

2013-05-31 Thread Kevin Grittner
Juliano Amaral Chaves wrote: > By doing insert into a table using a query, it seems that all > records of consultation were included bypassing the AFTER INSERT > triggers and as few as after all the records already included, > the TRIGGER is fired for each record, I wonder if this occurrence > is

[GENERAL] ECPG SET CONNECTION

2013-05-31 Thread Leif Jensen
Hi guys. In the ECPG manual (including latest 9.1.9) about ECPG SQL SET CONNECTION ; it is stated that "This is not thread-aware". When looking in the ecpg library code connect.c for ECPGsetconn( ... ), it looks very much like it is thread-aware if translated with the --enable-thread-

Re: [GENERAL] Cat the query be tuned further ?

2013-05-31 Thread Victor Yegorov
2013/5/31 Adarsh Sharma > explain analyze select sum(total_cost)as > cost,date_trunc('month',analytics_date)as monthDate from tableA > where inr_id in(select id from tableB where ct_id > ='4028cb972f1ff337012f1ffa1fee0001') and analytics_date between '2013-01-14 > 00:00:00' and '2013-05-29 00:00:

[GENERAL] Cat the query be tuned further ?

2013-05-31 Thread Adarsh Sharma
Hi all, I am using EDB9.2 on CentOS6.3 final server. Facing the slowness of a query that is taking more than 20 sec to execute. Below are the details : report_prod=# select pg_size_pretty(pg_total_relation_size('tableA')); pg_size_pretty 5691 MB report_prod=# select pg_size_p