Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Celia McInnis
Yes, thanks - that's nicer - I am now using: insert into t_array select array[data_comp]::mytype[] from t_composite; On Wed, Oct 25, 2017 at 5:25 PM, Tom Lane wrote: > "David G. Johnston" writes: > > On Wed, Oct 25, 2017 at 2:16 PM, Celia

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Tom Lane
"David G. Johnston" writes: > On Wed, Oct 25, 2017 at 2:16 PM, Celia McInnis >> Got it, finally... >> insert into t_array select array[row((data_comp).*)::mytype[] from >> t_composite; >> >> I'm not sure why I need (data_comp).* rather than

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread David G. Johnston
On Wed, Oct 25, 2017 at 2:16 PM, Celia McInnis wrote: > Got it, finally... > > insert into t_array select array[row((data_comp).*)::mytype[] from > t_composite; > > I'm not sure why I need (data_comp).* rather than some of the other things > that I tried and failed

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Celia McInnis
Got it, finally... insert into t_array select array[row((data_comp).*)::mytype[] from t_composite; I'm not sure why I need (data_comp).* rather than some of the other things that I tried and failed with... On Wed, Oct 25, 2017 at 3:47 PM, Tom Lane wrote: > Celia McInnis

[GENERAL] query not scaling

2017-10-25 Thread Rob Sargent
I have a query I cannot tame and I'm wondering if there's an alternative to the "between" clause I'm using. Perhaps a custom type could do better? I've tried the "<@" orperator and that changes the query plan significantly but the execution cost/time is not improved. Any suggestion or

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Celia McInnis
Thanks Tom - I saw how to do that for specified data, but I want to select the elements from a table of composite and don't know how to do that. I can't do insertions manually of each row separately! So how do I get material from my table of composite values into my table of array values? I am

Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Tom Lane
Celia McInnis writes: > My first question is: HOW do I populate this table, at first with arrays > containing one element from the t_composite table? > I have tried various things with no success. You didn't say what you tried, but I imagine it was something like

[GENERAL] How do I insert and update into a table of arrays of composite types via a select command?

2017-10-25 Thread Celia McInnis
I have a composite type like this, for example: create type mytype(a text, b text, c text); and a table create table t_cols(a text,b text,c text); containing some data. I have a table with my composite type: create table t_composite(data_comp mytype); and loaded data into it like so: insert

Re: [GENERAL] Installing PostgreSQL 10 on Mac OSX Undefined Symbol _heap_modify_tuple_by_cols

2017-10-25 Thread Ben Madin
to clarify, I commented them out, hence the # - it wasn't that I removed lines that were already commented out :) On 25 October 2017 at 22:21, Ben Madin wrote: > G'day Tom, > > Thanks for the feedback. I couldn't find anywhere that suggested that I > had set the CPPFLAGS or

Re: [GENERAL] Installing PostgreSQL 10 on Mac OSX Undefined Symbol _heap_modify_tuple_by_cols

2017-10-25 Thread Ben Madin
G'day Tom, Thanks for the feedback. I couldn't find anywhere that suggested that I had set the CPPFLAGS or CFLAGS environment variables, so I removed the following lines from my profile: #export USE_PGXS=1 #export PG_LIB_DIR="/usr/local/pgsql/lib" #export

Re: [GENERAL] libpq: PQreset not reconnecting connection, even though server is running

2017-10-25 Thread Geoff Winkless
I wrote: > I'm guessing (from "incomplete startup packet") that the connection > created by the new thread never actually succeeded, is that the > problem? Will PQreset only work on a connection that had previously > connected successfully? And as soon as I hit "send" on this email light dawned:

[GENERAL] libpq: PQreset not reconnecting connection, even though server is running

2017-10-25 Thread Geoff Winkless
Hi I have code in our "run this query" shim that automatically attempts to reconnect to the server if it finds that the connection is bad (usually it's just there to handle unexpected postmaster restarts). while (PQstatus(Conn) == CONNECTION_BAD) { fprintf(stderr, "postgres connection