[GENERAL] listen from slave database

2014-10-14 Thread ChoonSoo Park
Hi, I know I can't use "listen" from streaming slave database. >From the document ( http://www.postgresql.org/docs/9.3/static/hot-standby.html), (...Transactions started during hot standby will never be assigned a transaction ID and cannot write to the system write-ahead log. Therefore, the foll

[GENERAL] Can't start postgresql server

2014-06-24 Thread ChoonSoo Park
Hi, >From the pg_log folder, I can locate the following errors: LOG: database system was interrupted while in recovery at log time 2014-06-06 22:35:38 UTC HINT: If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target. LOG: could

Re: [GENERAL] PL/pgSQL Copy data from one table to another

2014-02-05 Thread ChoonSoo Park
On Wed, Feb 5, 2014 at 7:53 AM, George Ant wrote: > Hey Guys, > > I am trying to copy data from one table to another using plpgsql. The two > tables have different structure cause the new one is object-table. My > function is this : > > CREATE OR REPLACE FUNCTION copy_customers() RETURNS integer a

Re: [GENERAL] Is there a way to return "true"/"false" string for boolean type?

2014-01-07 Thread ChoonSoo Park
On Tue, Jan 7, 2014 at 2:55 PM, Joe Van Dyk wrote: > On Tue, Jan 7, 2014 at 10:41 AM, ChoonSoo Park wrote: > >> On Tue, Jan 7, 2014 at 1:29 PM, Szymon Guz wrote: >> >>> On 7 January 2014 19:11, ChoonSoo Park wrote: >>> >>>> Hello Gurus, >

Re: [GENERAL] Is there a way to return "true"/"false" string for boolean type?

2014-01-07 Thread ChoonSoo Park
On Tue, Jan 7, 2014 at 1:29 PM, Szymon Guz wrote: > On 7 January 2014 19:11, ChoonSoo Park wrote: > >> Hello Gurus, >> >> I have several tables with lots of boolean columns. >> When I run select query for the tables, I always get 't' or 'f' fo

[GENERAL] Is there a way to return "true"/"false" string for boolean type?

2014-01-07 Thread ChoonSoo Park
Hello Gurus, I have several tables with lots of boolean columns. When I run select query for the tables, I always get 't' or 'f' for boolean types. Is there a way to return 'true' or 'false' string for boolean type except using CASE WHEN ... clause? I mean global postgres configuration setting to

Re: [GENERAL] trigger without trigger call

2013-10-14 Thread ChoonSoo Park
On Mon, Oct 14, 2013 at 6:02 AM, Philipp Kraus < philipp.kr...@tu-clausthal.de> wrote: > > Am 14.10.2013 um 11:49 schrieb Alban Hertroys : > > > On Oct 14, 2013, at 8:18, Philipp Kraus > wrote: > > > >> Hello, > >> > >> I have written a update & delete trigger of a table. > >> My delete trigger r

Re: [GENERAL] How to get array of unique array values across rows?

2013-03-05 Thread ChoonSoo Park
Try this one. select X.client_id, array_agg(X.color) from (select distinct client_id, unnest(service_codes) as color from foo) X group by X.client_id; On Tue, Mar 5, 2013 at 3:28 PM, Ken Tanzer wrote: > I have a field containing a set of codes in a varchar array, each tied

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
It works! Thank you, Choon Park On Wed, Feb 20, 2013 at 12:06 PM, Russell Keane wrote: > ** ** > > >>Sorry, > > >>** ** > > >>It's not ordered by value. It's not sorted list unfortunately. It can > be '{100, 120, 102, 130, 104}'. > > >>** ** > > >>Do you have other suggestion? > > >>

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
Sorry, It's not ordered by value. It's not sorted list unfortunately. It can be '{100, 120, 102, 130, 104}'. Do you have other suggestion? Thank you, Choon Park On Wed, Feb 20, 2013 at 11:47 AM, Ian Lawrence Barwick wrote: > 2013/2/21 ChoonSoo Park > > > &g

[GENERAL] How to remove an item from integer array type

2013-02-20 Thread ChoonSoo Park
Hello Gurus, Table A has integer[] column. I need to delete specific integer value from that column. f1 | f2 1 {100, 101, 102, 103} 2 {200, 300, 400} I want to remove 101 from f2 and also preserve the order. f1 | f2 1 {100, 102, 103} 2 {20

Re: [GENERAL] How to setup chained CA?

2012-10-31 Thread ChoonSoo Park
Tom Lane wrote: > ChoonSoo Park writes: > > Then I tried to test more complex thing - chained CA. > > > Scenario 1. Postgresql having server.crt signed by Root CA and one of > > clients having postgresql.crt signed by intermediate CA. > > > Machine 1: Creat

[GENERAL] How to setup chained CA?

2012-10-30 Thread ChoonSoo Park
Greetings, I'm trying to setup SSL enabled postgresql environment. (PG: 9.1.6) With a single root CA, everything works fine. Machine 1: Create a self signed root certficate. Generate server certificate (server.crt) & client certificate (postgresql.crt) signed by the root certificate. Machine 2 (P

Re: [GENERAL] How to search for composite type array

2012-10-02 Thread ChoonSoo Park
Thank you David, unnest is the secret to this problem. I appreciate your help. -Choon Park On Mon, Oct 1, 2012 at 6:56 PM, David Johnston wrote: > *From:* pgsql-general-ow...@postgresql.org [mailto: > pgsql-general-ow...@postgresql.org] *On Behalf Of *ChoonSoo Park > *Sent:* Monday

[GENERAL] How to search for composite type array

2012-10-01 Thread ChoonSoo Park
Hello postgresql gurus, I want to have an array of composite type in a table. Retrieving/saving value work fine. I just wonder how I can search against composite type array. CREATE TYPE CompXYZ AS ( attr1 integer, attr2 text, attr3 inet ); CREA

Re: [GENERAL] Dynamic query execution using array

2012-07-06 Thread ChoonSoo Park
CAST? Best Regards, Choon Park On Fri, Jul 6, 2012 at 11:45 AM, Pavel Stehule wrote: > Hello > > 2012/7/6 ChoonSoo Park : > > Inside a function, I can execute dynamic query like this > > > > dept_id = 1; > > salary = 5; > > RETURN QUERY E

[GENERAL] Dynamic query execution using array

2012-07-06 Thread ChoonSoo Park
Inside a function, I can execute dynamic query like this dept_id = 1; salary = 5; RETURN QUERY EXECUTE 'SELECT * FROM employee WHERE dept_id = $1 and salary >= $2' using dept_id, salary; When the query condition is dynamically generated and number of parameters is also dynam

Re: [GENERAL] Opposite function of hstore each function

2012-03-02 Thread ChoonSoo Park
It works! Thank you, Choon Park On Fri, Mar 2, 2012 at 12:19 PM, Bosco Rama wrote: > ChoonSoo Park wrote: > > Each function returns key/value pairs from hstore type. > > Is there any opposite function that returns hstore type from key/value > rows? > > > > I kn

[GENERAL] Opposite function of hstore each function

2012-03-02 Thread ChoonSoo Park
Each function returns key/value pairs from hstore type. Is there any opposite function that returns hstore type from key/value rows? I know hstore (text[], text[]) can construct it. Is there any other choice? I have a table with ID & Description columns and want to return hstore type (ID1=>Desc1

[GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread ChoonSoo Park
I would like to construct hstore array from 2 dimensional array. For example, '{{f1, 1, f2, 123, f3, ABC, ...}, {f1, 2, f2, 345, f3, DEF, ...}}' Should be converted to 2 hstore values "f1"=>"1", "f2"=>"123", "f3"=>"ABC", ... "f2"=>"2", "f2"=>"345", "f3"=>"DEF", ... create or replace fun

Re: [GENERAL] How to code lo_creat & lo_write & lo_read in non-blocking mode

2012-01-09 Thread ChoonSoo Park
processes.) This is why I have been trying to find a way to execute blob save/retrieval operation in non-blocking mode. Thank you, Choon Park On Sat, Jan 7, 2012 at 5:05 AM, Dmitriy Igrishin wrote: > Hey ChoonSoo, > > 2012/1/6 ChoonSoo Park > >> I just wonder if there i

[GENERAL] How to code lo_creat & lo_write & lo_read in non-blocking mode

2012-01-06 Thread ChoonSoo Park
I just wonder if there is a way to program lo client interfaces (lo_creat, lo_write, lo_read) in non-blocking mode. PQsendQueryParams works perfect for executing a sql command in non-blocking mode. But I couldn't find a way for handling large objects. Do you have any example? Thank you, Choon Par

[GENERAL] PQreset needs to be executed twice to really connect to the postgresql database

2011-12-16 Thread ChoonSoo Park
Here is my sample code and I had to execute PQreset twice to connect to the database after asynchronous command ( PQsendQueryParams ). #include #include #include using namespace std; boolcheckStatus(PGconn* conn, bool readable, bool writable, int second, int microsecond) { int sock =