[GENERAL] How to retrieve values of 'array' field using C library (libpq)

2011-02-09 Thread Anton Maksimenkov
Hi. I use libpq in my program. And I can retrieve int and symbolic fields as simple as int unameFN, moneyFN... char *unamePTR, *moneyPTR... unameFN = PQfnumber(res, "uname"); moneyFN = PQfnumber(res, "money"); unamePTR = PQgetvalue(res, 0, unameFN); moneyPTR = PQgetvalue(res, 0, moneyFN); themo

Re: [GENERAL] consequent PQsendQueryPrepared() failed: another command is already in progress

2010-06-16 Thread Anton Maksimenkov
2010/6/16 Tom Lane : >> But it success only at first time, and then fail with error: >> ... "another command is already in progress" >> [ PQsendQuery followed by just one PQgetResult ] > > IIRC, you need to keep calling PQgetResult until it returns NULL > before the connection is considered cleared

[GENERAL] consequent PQsendQueryPrepared() failed: another command is already in progress

2010-06-15 Thread Anton Maksimenkov
I'm using libpq C Library. I prepared some query and trying to call it many times. But it success only at first time, and then fail with error: ... "another command is already in progress" Here is my testbed: int main (register int const argc, register char *const argv[]) { PGconn

Re: [GENERAL] ERROR: value out of range: underflow

2010-02-27 Thread Anton Maksimenkov
2010/2/26 Anton Maksimenkov : > When I try it in pgAdmin, first time it show me error: > -- > ERROR:  value out of range: underflow > CONTEXT:  PL/pgSQL function "myf_convert_phone18digits" line 12 at assignment > -- > SECOND (and consequences) time i

[GENERAL] ERROR: value out of range: underflow

2010-02-26 Thread Anton Maksimenkov
Hi. I have a simple function. CREATE OR REPLACE FUNCTION myf_convert_phone18digits( in_phone VARCHAR ) RETURNS BIGINT -- IMMUTABLE AS $$ DECLARE t_extent_len BIGINT; t_phone_18 BIGINT; t_multiplier BIGINT; BEGIN IF in_phone IS NULL OR in_phone = '' THEN RAISE EXCEPTION 'in_phone[%] I

Re: [GENERAL] Memory Usage and OpenBSD

2010-02-10 Thread Anton Maksimenkov
2010/2/10 Martijn van Oosterhout : >> Can anybody briefly explain me how one postgres process allocate >> memory for it needs? > > There's no real maximum, as it depends on the exact usage. However, in > general postgres tries to keep below the values in work_mem and > maintainence_workmem. Most of

Re: [GENERAL] Memory Usage and OpenBSD

2010-02-09 Thread Anton Maksimenkov
2010/2/9 Scott Marlowe : > On Tue, Feb 9, 2010 at 3:18 AM, Anton Maksimenkov wrote: >>> Isn't the usual advice here is to log the ulimit setting from the pg >>> startup script so you can what it really is for the user at the moment >> I think that "su" i

Re: [GENERAL] Memory Usage and OpenBSD

2010-02-09 Thread Anton Maksimenkov
2010/1/28 Scott Marlowe : >> related to maximum per-process data space.  I don't know BSD very well >> so I can't say if datasize is the only such value for BSD, but it'd be >> worth checking.  (Hmm, on OS X which is at least partly BSDish, I see >> -m and -v in addition to -d, so I'm suspicious Op

Re: [GENERAL] db crash after power crash

2006-05-28 Thread Anton Maksimenkov
May I ask - how can I do it...? My ordinary startup command (from rc.local) like this # su -l _postgresql -c "nohup /usr/local/bin/pg_ctl start -D /var/postgresql/data -l /var/postgresql/logfile -o '-D /var/postgresql/data'" But I tried # su -l _postgresql $ postgres -D /var/postgresql/data/ -P

[GENERAL] db crash after power crash

2006-05-28 Thread Anton Maksimenkov
Hi. Some hours ago there was a power failure with my test machine while active inserting data. After power back the OS done some "fsck", clean some files (related to postgres working directory). Then I connect to my DB and see this: billing=# \d ERROR: index "pg_attribute_relid_attnum_index" is