Re: [GENERAL] Unstable C Function

2016-09-21 Thread Ian Campbell
Thanks for personally replying, Tom. I appreciate it. You are correct. In the interim, I found the following change solved the issue: SPI_finish(); // move to here SRF_RETURN_DONE(funcctx); I'll look into tuplestore. Thanks for the hint. Fixed IMMUTABLE. Regards Ian Campbell On Thu, Sep 22, 20

Re: [GENERAL] Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

2016-09-21 Thread John R Pierce
On 9/21/2016 8:37 PM, Patrick B wrote: I'm using postgres 9.2 and got the following column: start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL SELECT start FROM test1; 2015-12-18 02:40:00 I need to split that date into two columns on my select: 2015-12-18 = date column 02:40:00 = time

Re: [GENERAL] Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

2016-09-21 Thread Adrian Klaver
On 09/21/2016 08:37 PM, Patrick B wrote: Hi guys, I'm using postgres 9.2 and got the following column: start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL SELECT start FROM test1; 2015-12-18 02:40:00 I need to split that date into two columns on my select: 2015-12-18 = date column 02:4

Re: [GENERAL] Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

2016-09-21 Thread Venkata B Nagothi
On Thu, Sep 22, 2016 at 1:37 PM, Patrick B wrote: > Hi guys, > > I'm using postgres 9.2 and got the following column: > > start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL > > > SELECT start FROM test1; > > > 2015-12-18 02:40:00 > > I need to split that date into two columns on my select: > > 2015-1

Re: [GENERAL] Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

2016-09-21 Thread Ian Barwick
On 22-09-2016 12:37, Patrick B wrote: > Hi guys, > > I'm using postgres 9.2 and got the following column: > > start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL > > > SELECT start FROM test1; > > > 2015-12-18 02:40:00 > > I need to split that date into two columns on my select: > > 2015

[GENERAL] Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

2016-09-21 Thread Patrick B
Hi guys, I'm using postgres 9.2 and got the following column: start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL SELECT start FROM test1; 2015-12-18 02:40:00 I need to split that date into two columns on my select: 2015-12-18 = date column 02:40:00 = time column How can I do that without modif

Re: [GENERAL] Re: performance problems with bulk inserts/updates on tsrange with gist-based exclude constrains

2016-09-21 Thread Jeff Janes
On Wed, Sep 21, 2016 at 2:18 PM, pinker wrote: > Jeff Janes wrote > > Try swapping the order of the columns in the exclude constraint. You > want > > the more selective criterion to appear first in the index/constraint. > > Presumably "key with =" is the most selective, especially if many of you

Re: [GENERAL] Unstable C Function

2016-09-21 Thread Tom Lane
Ian Campbell writes: > The function works fine on first call, sometimes more, then either resets > the connection or throws this on any further calls: > ERROR: cache lookup failed for type 0 SQL state: XX000 I think the core problem here is that you're dealing with pass-by-reference results from

Re: [GENERAL] json select question

2016-09-21 Thread John R Pierce
On 9/21/2016 4:54 PM, CS DBA wrote: How can i pull a unique list of all json column names? such as book_name, catalog_name, etc try json_object_keys() ... https://www.postgresql.org/docs/current/static/functions-json.html but this will only pull the top level keys, like (from the first row

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Patrick B
> > Rather than test.u...@example.com I was hoping for > values such as: > > test.4645364.@ example.com > > > test.8786756.@ example.com > > > > With UNIQUE UUID > > > is that possible? > > > I was able to do that using: SELECT cast(''test.''|| uuid_generate_v1() AS varchar(30)) || ''@example.c

[GENERAL] json select question

2016-09-21 Thread CS DBA
All; I'm working with a client running postgres 9.2, they have a table with a "json_data_string" column of type json the data looks something like this with lots of rows for each (i.e. lots of json_data_string->book_name rows, lots of json_data_string->catalog_name rows, etc: |'{ "book_n

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Patrick B
2016-09-22 10:02 GMT+12:00 Jim Nasby : > On 9/21/16 1:50 PM, Steve Petrie, P.Eng. wrote: > >> >> The reason I ask is -- the maximum length of a valid email address is >> actually 256 characters (or 254, according comments in the PHP function >> is_valid_email_address(...) that I found on the Inter

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Jim Nasby
On 9/21/16 1:50 PM, Steve Petrie, P.Eng. wrote: The reason I ask is -- the maximum length of a valid email address is actually 256 characters (or 254, according comments in the PHP function is_valid_email_address(...) that I found on the Internet at http://code.iamcal.com/ and use myself). In m

[GENERAL] Re: performance problems with bulk inserts/updates on tsrange with gist-based exclude constrains

2016-09-21 Thread pinker
Jeff Janes wrote > Try swapping the order of the columns in the exclude constraint. You want > the more selective criterion to appear first in the index/constraint. > Presumably "key with =" is the most selective, especially if many of your > periods are unbounded. I would not be so sure with tha

Re: [GENERAL] PgSQL versions supported on ubuntu 16 and debian 8

2016-09-21 Thread Alvaro Herrera
John R Pierce wrote: > On 9/19/2016 4:18 AM, MEERA wrote: > > > >Could someone please provide us this information? > > was answered nearly a week ago. Hmm, yeah, but you didn't CC the OP, and she is not subscribed. Meera: you can see the answer here: https://www.postgresql.org/message-id/flat/CA

Re: [GENERAL] generate CSV with Copy+Quotes - Postgres 9.2

2016-09-21 Thread Patrick B
> > >> > > Perhaps you mean you want to quote of all strings? For that you use FORCE > QUOTE. > eg: > COPY (SELECT > name_first > name_last, > email, > company > FROM > clients > ) > TO '/var/lib/pgsql/test1.csv' DELIMITER

Re: [GENERAL] PgSQL versions supported on ubuntu 16 and debian 8

2016-09-21 Thread John R Pierce
On 9/19/2016 4:18 AM, MEERA wrote: Could someone please provide us this information? was answered nearly a week ago. any current PG version (thats 9.1.latest to 9.5.latest) can be run on most any version of linux.Do note, 9.1 will be phased out soon, while 9.6 is nearly ready for releas

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Patrick B
kbran...@pwhome.com Yes.. it is a conde issue and not a DB issue 2016-09-22 6:50 GMT+12:00 Steve Petrie, P.Eng. : > Hi Patrick. > > - Original Message - From: "Patrick B" > To: "pgsql-general" > Sent: Wednesday, September 21, 2016 1:02 AM > Subject: [GENERAL] overwrite column data se

[GENERAL] postgres failed to start from services manager on windows 2008 r2

2016-09-21 Thread PHANIKUMAR G
hi, We are able to start the postgres from command line without any issue, if postgres is registered as windows service and tried to start it, we are facing an issue . *Problem:* We have registered postgres(version 9.3.4) as windows service on windows 2008 R2 and registration got succeeded.

[GENERAL] Unstable C Function

2016-09-21 Thread Ian Campbell
I'm running PG 9.5 on Win 10 64-bit. I'm compiling C under VS 2016. I am forming a function that will evolve into a somewhat complex beast. To test out my initial efforts, the function accepts an array of int4 (this works fine and the code for processing it is not shown here). The function then gr

Re: [GENERAL] PgSQL versions supported on ubuntu 16 and debian 8

2016-09-21 Thread MEERA
Hi, Could someone please provide us this information? On Thu, Sep 15, 2016 at 1:10 PM, MEERA wrote: > Hi, > > Could someone share below information? > > - PgSQL versions supported on ubuntu 16 > - PgSQL versions supported on debian 8 > > > -- > thanks and regards, > Meera R Nair > -- thanks

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Steve Petrie, P.Eng.
Hi Patrick. - Original Message - From: "Patrick B" To: "pgsql-general" Sent: Wednesday, September 21, 2016 1:02 AM Subject: [GENERAL] overwrite column data select - Postgres 9.2 I've got a table with email column: email CHARACTER VARYING(50) DEFAULT ''::CHARACTER VARYING NOT NULL

Re: [GENERAL] generate CSV with Copy+Quotes - Postgres 9.2

2016-09-21 Thread Melvin Davidson
On Wed, Sep 21, 2016 at 9:33 AM, Adrian Klaver wrote: > On 09/21/2016 02:23 AM, Patrick B wrote: > >> Hi guys, >> >> I'm exporting some data for testing purpose. >> >> COPY (SELECT >> name_first >> name_last, >> email, >> company >> FROM >>

Re: [GENERAL] generate CSV with Copy+Quotes - Postgres 9.2

2016-09-21 Thread Adrian Klaver
On 09/21/2016 02:23 AM, Patrick B wrote: Hi guys, I'm exporting some data for testing purpose. COPY (SELECT name_first name_last, email, company FROM clients ) TO '/var/lib/pgsql/test1.csv' DELIMITER ',' csv HEADER QUOT

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread
> Hi guys, > I've got a table with email column: > email CHARACTER VARYING(50) DEFAULT ''::CHARACTER VARYING NOT NULL, > There are 30k rows and the email column is not null... there is data in there. > But for testing purpose I need to overwrite the email. So the customer won't > get an email fr

[GENERAL] generate CSV with Copy+Quotes - Postgres 9.2

2016-09-21 Thread Patrick B
Hi guys, I'm exporting some data for testing purpose. COPY (SELECT > name_first > name_last, > email, > company > FROM > clients > ) > TO '/var/lib/pgsql/test1.csv' DELIMITER ',' csv HEADER QUOTE '"'; cat /var/lib/pgsql/test1.csv "","",hiddenem...@hotm

Re: [GENERAL] overwrite column data select - Postgres 9.2

2016-09-21 Thread Patrick B
2016-09-21 18:31 GMT+12:00 John R Pierce : > On 9/20/2016 10:56 PM, Patrick B wrote: > > update table tablename set email = 'test@example.com'; ? >> >> >> > > I can't overwrite the data into that column... > > I was hopping that in a SELECT I could replace the data from the email > column