[GENERAL] Need Guidance on Appending new data to existing field of Json data type

2014-10-29 Thread VENKTESH GUTTEDAR
Hello, As i am new to Postgresql, i am learning through experimenting things. i have a table with json data type field, so there is some data for example : { [ { a:b, b:c } ] } and now if i append data then it should be like : { [ { a:b, b:c }, { e:f, g:h } ] }

Re: [GENERAL] How to find earlest possible start times for given duration excluding reservations

2014-10-29 Thread Andrus
Hi! A further tweak; add the following to the WHERE clause: AND EXTRACT(DOW FROM times.period) != 0 I changed it to isodow to work in any locale. Your solution is more readable but Erwin answer in SO looks more optimized. I have 10 workes and 1 month reservation with 15 minute offsess from 8

Re: [GENERAL] Appending new data to existing field of Json data type

2014-10-29 Thread Michael Paquier
On Wed, Oct 29, 2014 at 3:42 PM, VENKTESH GUTTEDAR wrote: > As i am new to postgresql, i am learning through experimenting things. > > i have a table with json data type field, so there is some data for > example : > > { [ { a:b, b:c } ] } > > and now if i append data then it s

Re: [GENERAL] Appending new data to existing field of Json data type

2014-10-29 Thread VENKTESH GUTTEDAR
Ya agreed thats not legal JSON, that was typing mistake sorry for that, let me make you clear what i need exactly, I have table named (exampleTable) with json field as (example_list), and when i say SELECT * FROM exampleTable; id | example_list ---+--

[GENERAL] undefined struct 'pg_conn' on Windows7

2014-10-29 Thread Brilliantov Kirill Vladimirovich
Hello! I install postgre from postgresql-9.3.5-3-windows-x64.exe file and try use libpq.lib from it. My system Windows7 ServicePack1 and I use VisualStudioExpress 12 for write code. I add path to \include and \lib in project and include libpq-fe.h file. Unfortunately when I try build project I

Re: [GENERAL] undefined struct 'pg_conn' on Windows7

2014-10-29 Thread Albe Laurenz
Brilliantov Kirill Vladimirovich wrote: > I install postgre from postgresql-9.3.5-3-windows-x64.exe file and try > use libpq.lib from it. > My system Windows7 ServicePack1 and I use VisualStudioExpress 12 for > write code. > I add path to \include and > \lib in project and include libpq-fe.h file.

Re: [GENERAL] undefined struct 'pg_conn' on Windows7

2014-10-29 Thread Brilliantov Kirill Vladimirovich
Albe Laurenz wrote on 10/29/2014 11:57 AM: Any chance that you use a variable of type "PGconn" when it should be "PGconn*" ? Hello and thank you for your reply! Yes, you right, problem solved after change PGconn on PGconn*. -- Best regards, Brilliantov Kirill Vladimirovich -- Sent via p

Re: [GENERAL] Appending new data to existing field of Json data type

2014-10-29 Thread Adrian Klaver
On 10/29/2014 01:06 AM, VENKTESH GUTTEDAR wrote: Ya agreed thats not legal JSON, that was typing mistake sorry for that, let me make you clear what i need exactly, I have table named (exampleTable) with json field as (example_list), and when i say SELECT * FROM exampleTable; id | example_list

Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
Hello David, many thanks for your responses, Sorry for not providing the content of the fill_table3_function, but it just executes 3 insert queries in 3 different tables. And I've checked the time consuming operation is in this query (by the way, there was a little mistake in the name of the field

Re: [GENERAL] Query optimization

2014-10-29 Thread David Johnston
List preference is to inline post or, at worse, bottom post. Please do not top post. On Wed, Oct 29, 2014 at 11:06 AM, Jorge Arevalo wrote: > Hello David, many thanks for your responses, > > Sorry for not providing the content of the fill_table3_function, but it > just executes 3 insert queries

Re: [GENERAL] Query optimization

2014-10-29 Thread Tom Lane
Jorge Arevalo writes: > SELECT value1,value2,value3,value4, > value5, hstore(ARRAY['field9', 'field10', 'field11', 'field12', 'field13', > 'field14'], ARRAY[field9, field10, field11, field12, field13, field14) as > metadata, value7, (select array((select row(f1, f2) from table2 p where > p.f3 = fi

Re: [GENERAL] Query optimization

2014-10-29 Thread David Johnston
On Wed, Oct 29, 2014 at 11:53 AM, Tom Lane wrote: > Jorge Arevalo writes: > > > This is the result of EXPLAIN ANALYZE > > >QUERY > > PLAN > > >

Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
On Wed, Oct 29, 2014 at 8:05 PM, David Johnston wrote: > On Wed, Oct 29, 2014 at 11:53 AM, Tom Lane wrote: > >> Jorge Arevalo writes: >> >> > This is the result of EXPLAIN ANALYZE >> >> >QUERY >> > PLAN >> > >>

Re: [GENERAL] Query optimization

2014-10-29 Thread Tom Lane
Jorge Arevalo writes: >> On Wed, Oct 29, 2014 at 11:53 AM, Tom Lane wrote: >>> I'm also a bit confused as to why the planner is saying that the (SELECT >>> ARRAY(...)) bit is an InitPlan and not a SubPlan. That implies that >>> "field7" in the innermost WHERE clause is not a reference to table1

Re: [GENERAL] Query optimization

2014-10-29 Thread David Johnston
On Wed, Oct 29, 2014 at 12:14 PM, Jorge Arevalo wrote: > > SELECT value1,value2,value3,value4, value5, hstore(ARRAY['field9', > 'field10', 'field11', 'field12', 'field13', 'field14'], ARRAY[field9, > field10, field11, field12, field13, field14]) as metadata, value7, (select > array((select row(f1

Re: [GENERAL] Query optimization

2014-10-29 Thread Jorge Arevalo
On Wed, Oct 29, 2014 at 8:47 PM, David Johnston wrote: > On Wed, Oct 29, 2014 at 12:14 PM, Jorge Arevalo > wrote: > >> >> SELECT value1,value2,value3,value4, value5, hstore(ARRAY['field9', >> 'field10', 'field11', 'field12', 'field13', 'field14'], ARRAY[field9, >> field10, field11, field12, fiel

[GENERAL] Unexpected planner behavior with *_pattern_ops index matching

2014-10-29 Thread Fabio Ugo Venchiarutti
Greetings. I'm in the process of indexing a virtual file system (on 9.2.9, build info below) and I ran into what I perceive as an inconsistency in the way index viability is assessed by the planner. Perhaps I'm misinterpreting the docs, but it seems like stable functions don't behave as per

Re: [GENERAL] Appending new data to existing field of Json data type

2014-10-29 Thread VENKTESH GUTTEDAR
@Adrian Klaver, Thanks for this idea but still m really confused with how to update the json filed in the DB. is there any way to update the json field in the DB through view.? On Wed, Oct 29, 2014 at 7:37 PM, Adrian Klaver wrote: > On 10/29/2014 01:06 AM, VENKTESH GUTTEDAR wrote: > >> Ya agreed