Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Tom Lane
John Iliffe writes: > On Wednesday 08 March 2017 23:35:10 Tom Lane wrote: >> That isn't proving a lot: as I showed in my example lsof output, >> Fedora's lsof will map "5432" to "postgres" in the context of an IP >> port number. (I'm sure there's a way to turn that off, but -n ain't >> it.) > Yes

Re: [GENERAL] too may LWLocks

2017-03-08 Thread hariprasath nallasamy
oops its my bad implementation.. I was leaking locks and its fixed now. Thanks for the help! -harry On Thu, Mar 9, 2017 at 1:07 AM, Julien Rouhaud wrote: > On Wed, Mar 08, 2017 at 03:34:56PM +0530, hariprasath nallasamy wrote: > > Hi all > > I am building an extension using shared memory hash t

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 23:35:10 Tom Lane wrote: > John Iliffe writes: > > [root@prod04 John]# lsof -n | grep postmaster > > [root@prod04 John]# lsof -n | grep postgres | grep 5432 > > postgres 2760 postgres5u unix 0x9e5390b5b800 > > 0t0 > > > > 69422 /tmp/.s.P

Re: [GENERAL] count case when - PG 9.2

2017-03-08 Thread David G. Johnston
On Wednesday, March 8, 2017, Patrick B wrote: > Hi guys. How can I count using 'CASE WHEN'? > > Example: > > SELECT > > CASE > > WHEN AND c.regdate > EXTRACT(epoch FROM (now() - INTERVAL '14 > day')) > > THEN 'trial' > > WHEN last_pay > EXTRACT(epoch FROM (now() - INTERVAL

Re: [GENERAL] Which release does a commit end up getting into?

2017-03-08 Thread Michael Paquier
On Thu, Mar 9, 2017 at 1:41 PM, wrote: > I'm keen on using the functionality in the commit dated Jan 2, 2017 below. > > Probing the git repo however it exists only in the master branch and not > tagged in a release. The most recent release, tag REL9_6_2, contains commits > after Jan 2, but doe

[GENERAL] Which release does a commit end up getting into?

2017-03-08 Thread jpap00
Hello all, I'm keen on using the functionality in the commit dated Jan 2, 2017 below. Probing the git repo however it exists only in the master branch and not tagged in a release. The most recent release, tag REL9_6_2, contains commits after Jan 2, but does not contain this commit. The commit

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Tom Lane
John Iliffe writes: > [root@prod04 John]# lsof -n | grep postmaster > [root@prod04 John]# lsof -n | grep postgres | grep 5432 > postgres 2760 postgres5u unix 0x9e5390b5b800 0t0 > 69422 /tmp/.s.PGSQL.5432 type=STREAM That isn't proving a lot: as I showed in my

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Günce Kaya
Hi, When I open a new thread, I didn't know exactly what is true words to research. I read all of your posts and I think CSV parsing is the point to me. I've created my script and I share it to record. #cat cargo2.sh #!/bin/bash while IFS=, read uor_desc crime_type zip_code ucr_hierarchy date_rep

[GENERAL] count case when - PG 9.2

2017-03-08 Thread Patrick B
Hi guys. How can I count using 'CASE WHEN'? Example: SELECT CASE WHEN AND c.regdate > EXTRACT(epoch FROM (now() - INTERVAL '14 day')) THEN 'trial' WHEN last_pay > EXTRACT(epoch FROM (now() - INTERVAL '37 day')) THEN 'paying' END as account_status,

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 17:22:21 Adrian Klaver wrote: > On 03/08/2017 01:48 PM, John Iliffe wrote: > > On Wednesday 08 March 2017 15:13:29 Tom Lane wrote: > >> John Iliffe writes: > >>> I tried psql but it won't work, as expected, because socket 5432 is > >>> not available. > >> > >> Actually,

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 17:11:16 Adrian Klaver wrote: > On 03/08/2017 02:01 PM, John Iliffe wrote: > > Please use Reply All so others get your posts. > Ccing list > > > On Wednesday 08 March 2017 16:40:03 you wrote: > >> On 03/08/2017 01:28 PM, John Iliffe wrote: > >>>

Re: [GENERAL] Seq scan X Index scan

2017-03-08 Thread David G. Johnston
On Wed, Mar 8, 2017 at 3:32 PM, Patrick B wrote: > Why is SEQ SCAN faster than index scan? > Same number of evaluated record and less effort-per-record​. You only win with an index if you can evaluate fewer records to make up for the extra effort per record that querying an index involves compa

[GENERAL] Seq scan X Index scan

2017-03-08 Thread Patrick B
Hi all. I'm testing GIN indexes on a wildcard search. Basically I've created this on my test environment: create table test_gin_index ( > name_first CHARACTER VARYING(80) DEFAULT ''::CHARACTER VARYING, > name_last CHARACTER VARYING(80) DEFAULT ''::CHARACTER VARYING > ); insert into test_gin_ind

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 01:48 PM, John Iliffe wrote: On Wednesday 08 March 2017 15:13:29 Tom Lane wrote: John Iliffe writes: I tried psql but it won't work, as expected, because socket 5432 is not available. Actually, that's not all that expected. psql by default would try to connect via a Unix socke

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 02:01 PM, John Iliffe wrote: Please use Reply All so others get your posts. Ccing list On Wednesday 08 March 2017 16:40:03 you wrote: On 03/08/2017 01:28 PM, John Iliffe wrote: --- [root@prod04 John]# su postgres [postgres@prod04 John]$ pg_ctl start

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 15:13:29 Tom Lane wrote: > John Iliffe writes: > > I tried psql but it won't work, as expected, because socket 5432 is > > not available. > > Actually, that's not all that expected. psql by default would try to > connect via a Unix socket, so it wouldn't matter whether

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 01:28 PM, John Iliffe wrote: On Wednesday 08 March 2017 11:18:59 Adrian Klaver wrote: On 03/08/2017 07:37 AM, John Iliffe wrote: On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: John Iliffe writes: Now, running as user postgres I try and start as stated in the manual postgre

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 11:18:59 Adrian Klaver wrote: > On 03/08/2017 07:37 AM, John Iliffe wrote: > > On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: > >> John Iliffe writes: > >>> Now, running as user postgres I try and start as stated in the > >>> manual postgres -D /usr/pgsql_tablespace

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Tom Lane
John Iliffe writes: > I tried psql but it won't work, as expected, because socket 5432 is not > available. Actually, that's not all that expected. psql by default would try to connect via a Unix socket, so it wouldn't matter whether or not the postmaster had been able to open an IPv4 port. The

Re: [GENERAL] too may LWLocks

2017-03-08 Thread Julien Rouhaud
On Wed, Mar 08, 2017 at 03:34:56PM +0530, hariprasath nallasamy wrote: > Hi all > I am building an extension using shared memory hash table and for locking > hash table i am using LWLocks, but the thing was when i try to run some 1k > queries one after other, for each query i am getting one LWLock

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 10:25 AM, John Iliffe wrote: On Wednesday 08 March 2017 11:37:27 Adrian Klaver wrote: On 03/08/2017 07:37 AM, John Iliffe wrote: On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: John Iliffe writes: Now, running as user postgres I try and start as stated in the manual postgre

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 10:12 AM, John Iliffe wrote: See embedded. Ccing list will not be able to use it. Yes, but if that happens at least I will be able to back out because I can go back and start the old postgresql since it is on a different /usr partition. That's the reason for the install dire

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 11:37:27 Adrian Klaver wrote: > On 03/08/2017 07:37 AM, John Iliffe wrote: > > On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: > >> John Iliffe writes: > >>> Now, running as user postgres I try and start as stated in the > >>> manual postgres -D /usr/pgsql_tablespace

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread Albe Laurenz
Yogesh Sharma wrote: > I observed there is some problem in REINDEX operation in older PostgreSQL > versions. > That why i want to add explicitly lock. Which problem? Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Karl Czajkowski
On Mar 08, Rob Sargent modulated: > Yes Karl, I agree. I admitted as much. But if it's clean, as in > free of quoted commas, life is much more simple. I've lost site of > whether or not the OP knows his situation w.r.t. to this. The awk > line will tell him and for a one-off load this can make

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Rob Sargent
On 03/08/2017 09:52 AM, Karl Czajkowski wrote: On Mar 08, Rob Sargent modulated: Yes Karl, I agree. I admitted as much. But if it's clean, as in free of quoted commas, life is much more simple. I've lost site of whether or not the OP knows his situation w.r.t. to this. The awk line will t

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Bret Stern
I'll throw in. If tab delimited is available, perhaps that option will work better...or.. use Access to find the violations of the quote comma delimited assumptions, then export from Access an import Bret On Wed, 2017-03-08 at 08:36 -0800, Karl Czajkowski wrote: > I believe that in its fully g

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Rob Sargent
Meant to ask before, can you show the command you are using to connect? My memory says OP didn't use --host, which often leads to trying the socket. Do we know that's enabled in pg_hba? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscrip

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Rob Sargent
On 03/08/2017 09:36 AM, Karl Czajkowski wrote: I believe that in its fully glory, you cannot reliably locate CSV record boundaries except by parsing each field in order including quote processing. Individual records may have arbitrary numbers of field and record separator characters within the

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 07:37 AM, John Iliffe wrote: On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: John Iliffe writes: Now, running as user postgres I try and start as stated in the manual postgres -D /usr/pgsql_tablespaces The result is: [postgres@prod04 postgresql-9.6.2]$ postgres -D /usr/pgsql

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Karl Czajkowski
I believe that in its fully glory, you cannot reliably locate CSV record boundaries except by parsing each field in order including quote processing. Individual records may have arbitrary numbers of field and record separator characters within the values. Karl On Mar 08, Rob Sargent modulated:

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Rob Sargent
Since bash has been bandied about in this thread I presume awk is available. Here's how I would check just how 'csv'ish the incoming file is. awk -F"," '{a[$NF]++}END{for(i in a){printf "%d lines have %d fields(columns)\n", a[i], i}}' csvfilename If this doesn't produce one line you have

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread David G. Johnston
On Wed, Mar 8, 2017 at 9:13 AM, Karl Czajkowski wrote: > > With the temporary table, you can use SQL for most validation or data > interrogation, but you need to know at least enough schema information > in advance to form the COPY statement. Parsing the CSV header row to > plan your work puts yo

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 07:37 AM, John Iliffe wrote: On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: John Iliffe writes: Now, running as user postgres I try and start as stated in the manual postgres -D /usr/pgsql_tablespaces The result is: [postgres@prod04 postgresql-9.6.2]$ postgres -D /usr/pgsql

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Karl Czajkowski
On Mar 08, John McKown modulated: ... > ​I agree. I went with a "pure BASH" approach because it is what the > user asked for & I wasn't sure what language she might be comfortable > with. I use PERL a lot. Or maybe I should say that I abuse PERL a lot. > Such as a PERL script with writes out anothe

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Adrian Klaver
On 03/08/2017 07:44 AM, John Iliffe wrote: See embedded. Just to be clear you installed in: /usr/postgres-9.6.2 yes, and the expected directories /usr/postgres-9.6.2/bin, /include, /lib, and /share are all there. but created the data directory in: /usr/pgsql_tablespaces Yes, I did tha

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread David G. Johnston
On Wed, Mar 8, 2017 at 3:42 AM, Yogesh Sharma wrote: > I observed there is some problem in REINDEX operation in older PostgreSQL > versions. > That why i want to add explicitly lock. > > ​You should probably define "current" and "older" in your personal context - what version(s) are you targeting

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread David G. Johnston
On Tue, Mar 7, 2017 at 11:21 PM, Yogesh Sharma wrote: > Dear David, > > I want to apply explicitly lock mechanism once inset operation is in > progress then REINDEX will wait. > And vice versa. > So, please let me know this type of handling is possible. > > ​You want to exclusively lock a table

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
See embedded. On Wednesday 08 March 2017 00:09:56 Adrian Klaver wrote: > On 03/07/2017 08:17 PM, John Iliffe wrote: > > I was unable to get postgres started so I did a very basic > > compile/install to test it. The configuration line was: > > > > ./configure --prefix=/usr/postgres-9.6.2 > > > >

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
On Wednesday 08 March 2017 00:01:32 Tom Lane wrote: > John Iliffe writes: > > Now, running as user postgres I try and start as stated in the manual > > postgres -D /usr/pgsql_tablespaces > > > > The result is: > > [postgres@prod04 postgresql-9.6.2]$ postgres -D /usr/pgsql_tablespaces > > LOG: co

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Melvin Davidson
On Wed, Mar 8, 2017 at 10:00 AM, Tom Lane wrote: > John Iliffe writes: > > When the programme exited it left another postmaster.pid file so I > deleted > > that one too. > > You haven't shown us the program actually exiting, and basically the only > way to get the postmaster to exit without remo

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread Tom Lane
John Iliffe writes: > When the programme exited it left another postmaster.pid file so I deleted > that one too. You haven't shown us the program actually exiting, and basically the only way to get the postmaster to exit without removing its pid file is to kill -9 it. Now I am suspicious that y

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread John McKown
On Wed, Mar 8, 2017 at 8:45 AM, vinny wrote: > On 2017-03-08 10:13, Günce Kaya wrote: > >> Hi all, >> >> I want to import content of CSV file to a table via bash script >> without creating temporary table and I also want to skip some columns >> in CSV file (for instance, CSV file has 12 column an

Re: [GENERAL] Unable to start postgresql

2017-03-08 Thread John Iliffe
Yes, that file was present, so I deleted it. Attempted to restart and got the same result: LOG: could not bind IPv4 socket: Cannot assign requested address HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. LOG: database system was interrupted; la

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread vinny
On 2017-03-08 10:13, Günce Kaya wrote: Hi all, I want to import content of CSV file to a table via bash script without creating temporary table and I also want to skip some columns in CSV file (for instance, CSV file has 12 column and main table has only 2 column, If possible I would use only 2

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Martijn Tonies (Upscene Productions)
Hi, If this is a one-time thing, you can use the Import Data tool in Database Workbench, see http://www.upscene.com/documentation/dbw5/tools_dataimport.htm Hope this helps. With regards, Martijn Tonies Upscene Productions http://www.upscene.com Database Workbench - developer tool for Oracle,

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread John McKown
On Wed, Mar 8, 2017 at 3:13 AM, Günce Kaya wrote: > Hi all, > > I want to import content of CSV file to a table via bash script without > creating temporary table and I also want to skip some columns in CSV file > (for instance, CSV file has 12 column and main table has only 2 column, If > possib

Re: [GENERAL] import CSV file to a table

2017-03-08 Thread Vick Khera
Since you're using bash, I will assume you are not averse to using a slightly complicated pipeline. First, install this: https://github.com/wireservice/csvkit Then use that to cut out the columns, you want and pipe the result into psql with an appropriate \copy command. On Wed, Mar 8, 2017 at 4:1

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread Yogesh Sharma
Dear Albe, Thanks for your support. I observed there is some problem in REINDEX operation in older PostgreSQL versions. That why i want to add explicitly lock. Regards, Yogesh On Wednesday, March 8, 2017, Albe Laurenz wrote: > Yogesh Sharma wrote: > > I want to apply explicitly lock mechanis

[GENERAL] too may LWLocks

2017-03-08 Thread hariprasath nallasamy
Hi all I am building an extension using shared memory hash table and for locking hash table i am using LWLocks, but the thing was when i try to run some 1k queries one after other, for each query i am getting one LWLock but on executing 200th query i am getting the error *ERROR: too many LWLocks t

Re: [GENERAL] Postgres, apps, special characters and UTF-8 encoding

2017-03-08 Thread Albe Laurenz
Ken Tanzer wrote: > Hi. I've got a recurring problem with character encoding for a > Postgres-based web PHP app, and am > hoping someone can clue me in or at least point me in the right direction. > I'll confess upfront my > understanding of encoding issues is extremely limited. Here goes. >

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread Albe Laurenz
Yogesh Sharma wrote: > I want to apply explicitly lock mechanism once inset operation is in > progress then REINDEX will wait. > And vice versa. > So, please let me know this type of handling is possible. Maybe I misunderstand something, but you don't need to do that because it happens automatic

[GENERAL] import CSV file to a table

2017-03-08 Thread Günce Kaya
Hi all, I want to import content of CSV file to a table via bash script without creating temporary table and I also want to skip some columns in CSV file (for instance, CSV file has 12 column and main table has only 2 column, If possible I would use only 2 column in CSV file) Is there any way to d

Re: [GENERAL] Request to confirm which command is use for exclusive operation

2017-03-08 Thread Yogesh Sharma
Dear Scott, How to handle table with token? How to implement this? Regards, Yogesh On Wednesday, March 8, 2017, Scott Marlowe wrote: > On Tue, Mar 7, 2017 at 11:55 PM, Scott Marlowe > wrote: > > On Tue, Mar 7, 2017 at 11:21 PM, Yogesh Sharma > wrote: > >> Dear David, > >> > >> I want to app