Re: [GENERAL] Terms advice.

2010-11-26 Thread Craig Ringer
On 11/26/2010 09:37 PM, Dmitriy Igrishin wrote: Hey all, I am working on C++ library to work with PostgreSQL. Are you aware of libpqxx ? Is your intent to implement the protocol from scratch in c++ rather than wrap libpq? If so, why? -- Craig Ringer -- Sent via pgsql-general mailing list

Re: [GENERAL] Help on explain analyze

2010-11-26 Thread Marc Mamin
Hello, did you also try defininig partial indexes? e.g. CREATE INDEX xx on task_definitions (ctrlid) WHERE (name::text = 'UseWSData') CREATE INDEX yy on ctrl_definitions (ctrlid) WHERE (name::text = 'IrrPeriodStart') HTH, Marc Mamin -Original Message- From: pgsql-general-ow...@postgr

Re: [GENERAL] number of not null arguments

2010-11-26 Thread Pavel Stehule
Hello this function doesn't exists, but you can you to write (min PostgreSQL 8.4) create or replace function notnull_count(variadic anyarray) returns int as $$select count(x)::int from unnest($1) g(x)$$ language sql; it working just for scalar types: pavel=# SELECT notnull_count(1, 1, NULL, NU

[GENERAL] Help on explain analyze

2010-11-26 Thread Leif Jensen
Hi guys, I have a rather complex view that sometimes takes an awful long time to execute. I have tried to do an 'explain analyze' on it. My intention was to try to optimize the tables involved by creating some indexes to help the lookup. I looked for the "Seq Scan's and created appropriat

[GENERAL] number of not null arguments

2010-11-26 Thread Murat Kabilov
Hello, Is there a function which returns number of not null arguments? SELECT notnull_count(1, 1, NULL, NULL) notnull_count --- 2 SELECT notnull_count(ARRAY[1,2,3], ARRAY[10,20,30], NULL, ARRAY[NULL]) notnull_count --- 3 Thanks -- Murat Kabil

Re: [GENERAL] plpyhton

2010-11-26 Thread Martin Gainty
depends on the configuration implemented to enable caching capability for each type *usually* fastest access can be achived by implementin a Procedure which loads into Procedure Cache allowing consequent accesses to the Procedure 'in memory' (vs Disk I/O) Martin Gainty ___

Re: [GENERAL] plpyhton

2010-11-26 Thread Joshua Tolley
On Fri, Nov 26, 2010 at 05:28:52PM +0530, c k wrote: > Thanks for your reply. > But if a database has 100+ connections then isn't loading any such > interpreter consumes more memory and requires more CPU? Does all PL > languages behave in the same fashion? If there are lots of connections, and eac

[GENERAL] Terms advice.

2010-11-26 Thread Dmitriy Igrishin
Hey all, I am working on C++ library to work with PostgreSQL. I am trying to follow strong correctness in terms. One of my current dilemmas is how to distinguish the results of commands in correct terms. E.g., is it correct to call commands which returns tuples as "queries" but commands like whic

Re: [GENERAL] plpyhton

2010-11-26 Thread c k
Thanks for your reply. But if a database has 100+ connections then isn't loading any such interpreter consumes more memory and requires more CPU? Does all PL languages behave in the same fashion? Regards, CPK On Thu, Nov 25, 2010 at 11:12 AM, Joshua Tolley wrote: > On Wed, Nov 24, 2010 at 11:56

Re: [GENERAL] Question about catching exception

2010-11-26 Thread tv
> Hello > > you have to parse a sqlerrm variable That's one way to do that. Another - more complex but more correct in many cases is using two separate blocks. BEGIN ... do stuff involving constraint A EXCEPTION WHEN unique_violation THEN ... END; BEGIN ... do stuff involving constraint

Re: [GENERAL] Question about catching exception

2010-11-26 Thread Pavel Stehule
Hello you have to parse a sqlerrm variable CREATE OR REPLACE FUNCTION public.test(a integer, b integer) RETURNS void LANGUAGE plpgsql AS $function$ begin insert into foo values(a,b); exception when unique_violation then raise notice '% %', sqlerrm, sqlstate; end; $function$ postgres=#

[GENERAL] Question about catching exception

2010-11-26 Thread A B
Hello! I have a question about catching exceptions. If I write a plpgsql function like this begin do stuff; exception when X then when Y then ... end; If the "do stuff" part can result in two different unique_violation exception (having two unique constraints), how can I detect w