[GENERAL] How to synchronize tables in remote (production) and local databases in case if the structure of local database's table has been modified

2014-10-08 Thread Vitaly Isaev
Hello, I have faced with a complicated case of table synchronisation. The full description of the problem (with some figures) is posted here: http://stackoverflow.com/questions/26237661/postgresql-update-table-with-new-records-from-the-same-table-on-remote-server Here it the partial repost of my

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Andrus
Hi! also, it generates statement which tries to change all columns to one character length columns. Andrus. From: Andrus Sent: Monday, October 06, 2014 8:11 PM To: Melvin Davidson Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Converting char to varchar automatically Hi! SELECT

[GENERAL] Convert raw fields into Datum

2014-10-08 Thread sri harsha
Hi, I have the raw fields of a particular row in char * . Now my requirement is to convert these value into datum * . How should i go about this ? Does converting into datum depends on the type of the field too ? -- Harsha

Re: [GENERAL] psql connection issue

2014-10-08 Thread Adrian Klaver
On 10/07/2014 09:10 PM, Stephen Davies wrote: The permissions on the socket are 777 owner/group postgres. I installed the 9.3 onto the Centos 7 server using the repo at postgresql.org. (http://yum.postgresql.org/9.3/redhat/rhel-$releasever-$basearch) There is no /var/run/postgresql and find

Re: [GENERAL] Convert raw fields into Datum

2014-10-08 Thread Tom Lane
sri harsha sriharsha9...@gmail.com writes: I have the raw fields of a particular row in char * . Now my requirement is to convert these value into datum * . How should i go about this ? Does converting into datum depends on the type of the field too ? Yes. You are probably looking for

[GENERAL] Sync production DB with development?

2014-10-08 Thread Israel Brewster
I am currently doing periodic syncs of one of my production databases to my development database using the command pg_dump -ch production host database name | psql database name, run on my development server. This works well enough, but as the size of the production database grows, this command

Re: [GENERAL] Sync production DB with development?

2014-10-08 Thread Emanuel Calvo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 El 08/10/14 a las 14:01, Israel Brewster escibió: I am currently doing periodic syncs of one of my production databases to my development database using the command pg_dump -ch production host database name | psql database name, run on my

Re: [GENERAL] Processor usage/tuning question

2014-10-08 Thread Jeff Janes
On Tue, Oct 7, 2014 at 12:06 PM, israel isr...@eraalaska.net wrote: Thank you all for the advice. It looks like the load is due to a query that is taking around 1300ms to complete - a query that is run by every client connected (probably half a dozen or so, although I don't have specific

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Andrus
Hi! Using Toms recommendation I added not attisdropped and now got the query SELECT 'ALTER TABLE ' || quote_ident(n.nspname) || '.' || quote_ident(c.relname) || ' ALTER COLUMN ' || quote_ident(a.attname) || ' TYPE varchar;' FROM pg_class c JOIN pg_namespace n ON

Re: [GENERAL] Processor usage/tuning question

2014-10-08 Thread Israel Brewster
---Israel BrewsterSystems Analyst IIRavn Alaska5245 Airport Industrial RdFairbanks, AK 99709(907) 450-7293---BEGIN:VCARD VERSION:3.0 N:Brewster;Israel;;; FN:Israel Brewster ORG:Frontier Flying Service;MIS

Re: [GENERAL] Sync production DB with development?

2014-10-08 Thread Israel Brewster
On Oct 8, 2014, at 9:30 AM, Emanuel Calvo emanuel.ca...@2ndquadrant.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 El 08/10/14 a las 14:01, Israel Brewster escibió: I am currently doing periodic syncs of one of my production databases to my development database using the

Re: [GENERAL] Sync production DB with development?

2014-10-08 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 so I could easily be over a minute of sync time in another two years. I would really rather not have to wait several minutes every time I want to update my development data. A minute is really not that long of a wait, especially given the

Re: [GENERAL] Sync production DB with development?

2014-10-08 Thread Emanuel Calvo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 El 08/10/14 a las 17:24, Israel Brewster escibió: On Oct 8, 2014, at 9:30 AM, Emanuel Calvo emanuel.ca...@2ndquadrant.com wrote: El 08/10/14 a las 14:01, Israel Brewster escibió: I am currently doing periodic syncs of one of my

Re: [GENERAL] Sync production DB with development?

2014-10-08 Thread Jeff Ross
On 10/8/14, 2:24 PM, Israel Brewster wrote: Agreed. and no, I don't need all the data. But pg_dump doesn't give me an option to, say, only grab the last week of data. You might want to check out pg_sample. It lets you get a referentially consistent sample of a database. You specify the

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Melvin Davidson
This revised query should give you what you need: SELECT 'ALTER TABLE ' || quote_ident(n.nspname) || '.' || quote_ident(c.relname) || ' ALTER COLUMN ' || quote_ident(a.attname) || ' TYPE varchar(' || i.character_maximum_length || ');' FROM pg_class c JOIN

Re: [GENERAL] How to synchronize tables in remote (production) and local databases in case if the structure of local database's table has been modified

2014-10-08 Thread Sergey Konoplev
On Wed, Oct 8, 2014 at 12:49 AM, Vitaly Isaev vis...@team112.ru wrote: I am trying to figure out how to dump the contents of several selected tables from server in order to update the tables on development workstations. The biggest challenge is that the tables I'm trying to synchronize may be

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Andrus
Hi! Thank you. This revised query should give you what you need: SELECT 'ALTER TABLE ' || quote_ident(n.nspname) || '.' || quote_ident(c.relname) || ' ALTER COLUMN ' || quote_ident(a.attname) || ' TYPE varchar(' || i.character_maximum_length || ');' FROM pg_class c

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Melvin Davidson
There really is no easy way to make a single ALTER for each table unless you use a programming language. However, adding a GROUP BY c.relname, a.attname would certainly simplify editing. Then you can combine all the ALTER COLUMN's for each table. On Wed, Oct 8, 2014 at 6:21 PM,

[GENERAL] Importing large object (with lo_import) to table in separate tablespaces takes up lots of space in $PGDATA

2014-10-08 Thread Andreas Joseph Krogh
Hi all.   I'm having a database, called apeland, which at first (when created) was in the default-tablespace (in $PGDATA), then I moved it with the commands:   # create tablespace apeland location '/home/andreak/programs/postgresql/9.3.5/tablespaces/apeland'; CREATE TABLESPACE   Check

Re: [GENERAL] psql connection issue

2014-10-08 Thread Stephen Davies
This is not the same issue. However, I had already disabled SELinux for other reasons. The actual cause of my issue was the new private tmp facility in systemd startup of httpd. This makes the PostgreSQL socket invisible to CGI scripts. We have survived for many years without this before

Re: [GENERAL] Importing large object (with lo_import) to table in separate tablespaces takes up lots of space in $PGDATA

2014-10-08 Thread Guillaume Lelarge
Hi, Le 9 oct. 2014 01:31, Andreas Joseph Krogh andr...@visena.com a écrit : Hi all. I'm having a database, called apeland, which at first (when created) was in the default-tablespace (in $PGDATA), then I moved it with the commands: # create tablespace apeland location

Re: [GENERAL] Converting char to varchar automatically

2014-10-08 Thread Andrus
Hi! There really is no easy way to make a single ALTER for each table unless you use a programming language. I’snt SQL a programming language ? However, adding a GROUP BY c.relname, a.attname would certainly simplify editing. Then you can combine all the ALTER COLUMN's for