Re: [GENERAL] Help me with this multi-table query

2010-03-23 Thread Nilesh Govindarajan
On 03/24/2010 12:45 AM, Dean Rasheed wrote: On 23 March 2010 11:07, Nilesh Govindarajan wrote: Hi, I want to find out the userid, nodecount and comment count of the userid. I'm going wrong somewhere. Check my SQL Code- select u.uid, count(n.nid) nc , count(c.cid) cc from users u left join n

Re: [GENERAL] Avoiding deadlocks on mass delete / update

2010-03-23 Thread Craig Ringer
Роман Маширов wrote: > I've got a simple 'spool' table, one process 'worker' reads and updates > this table, other 'stat' performs 'delete ... where ... returning *'. > Sometimes I've got dedlocks on delete operation in 'stat', seems like at > the moment of expiration of data by timeout some state

Re: [GENERAL] server-side extension in c++

2010-03-23 Thread Craig Ringer
Igor wrote: > Hi All, > > Is there an easy way to add c++ files to my simple pgsql module ? My Makefile > is as follows - > > === > MODULES = pg_uservars > DATA_built = pg_uservars.sql > PGXS := $(shell pg_config --pgxs) > include $(PGXS) > === > > I've got "pg_uservars.c" and "hv.cc" and I'd

Re: [GENERAL] Help me with this multi-table query

2010-03-23 Thread Dean Rasheed
On 23 March 2010 11:07, Nilesh Govindarajan wrote: > Hi, > > I want to find out the userid, nodecount and comment count of the userid. > > I'm going wrong somewhere. > > Check my SQL Code- > > select u.uid, count(n.nid) nc , count(c.cid) cc from users u left join node > n on ( n.uid = u.uid ) left

Re: Fwd: [GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Tom Lane
Sergio Ramazzina writes: > [ test case ] It seems to work as expected for me: regression=# insert into tpm_wind_dcn values ('r','i','2010-01-09',42); INSERT 0 0 regression=# select * from tpm_wind_dcn; router | interface |data| qora | m1 | m2 | m3 | m4 | m5 | m6 +---+--

[SPAM] Re: [GENERAL] pgreplay log file replayer released

2010-03-23 Thread Ben Chobot
On Mar 23, 2010, at 4:08 AM, Dimitri Fontaine wrote: >> One thing that Tsung, recording >> queries as proxy, will never be able to handle are encrypted connections, >> but I guess that's a minor problem. > > Yes, because you typically run the proxy only to record sessions, in > order to prepare t

Re: [GENERAL] strange

2010-03-23 Thread Tom Lane
=?UTF-8?Q?Filip_Rembia=C5=82kowski?= writes: > For the record, I've recently observed such behaviour on non-cheap > 64bit server harware. > That was Pg 8.4.0. hardware specs available on request. > EXPLAIN ANALYZE SELECT was over 2 times slower that SELECT. repeatedly. > Answering an obligatory

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tom Lane
"A. Kretschmer" writes: > In response to Tuo Pe : >> CREATE OR REPLACE FUNCTION TryOverlap(text, text) RETURNS boolean AS $$ >> DECLARE >> ts_start timestamp with time zone := CAST ($1 AS TIMESTAMP WITH TIME ZONE); >> ts_end timestamp with time zone := CAST ($2 AS TIMESTAMP WITH TIME ZONE); >> alk

[GENERAL] 2nd set of PostgreSQL 9.0 Alpha4 RPMs are available

2010-03-23 Thread Devrim GÜNDÜZ
I just released 2nd set of RPMs for 4th Alpha of the upcoming 9.0 release. Changelog is: - Move euc2004_sjis2004.so into server package. This explains why initdb is broken when -contrib is not installed. Fixes #11. - Improve/fix alternatives section initdb problem was a blocker, that's why I r

Fwd: [GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Sergio Ramazzina
Sorry but I mistakenly replied only to Albe. Repost it to the list. Apologize me but also the server version is not correct is 8.1.11 (I forget the last 1). Regards S -- Forwarded message -- From: Sergio Ramazzina Date: 2010/3/23 Subject: Re: [GENERAL] Before triggers and usage

[GENERAL] Help me with this multi-table query

2010-03-23 Thread Nilesh Govindarajan
Hi, I want to find out the userid, nodecount and comment count of the userid. I'm going wrong somewhere. Check my SQL Code- select u.uid, count(n.nid) nc , count(c.cid) cc from users u left join node n on ( n.uid = u.uid ) left join comments c on ( c.uid = u.uid ) group by u.uid having u.uid

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tuo Pe
--- On Tue, 3/23/10, A. Kretschmer wrote: > You have alku and loppu as variable and as table-column, > that's a bad > idea, maybe that's an error, i'm not sure. > > Btw.: you can use the PERIOD-datatype: I will look into it. Thanks for the tip. Tuo -- Sent via pgsql-general mailing

Re: [GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Albe Laurenz
Sergio Ramazzina wrote: > I'm new to postgresql and I need some help to understand the > behaviour of before insert triggers in postgresql. I'm trying the sample > documented in the user manual about implementing table partitions > (http://www.postgresql.org/docs/8.4/interactive/ddl-partitioning.

Re: [GENERAL] pgreplay log file replayer released

2010-03-23 Thread Albe Laurenz
Dimitri Fontaine wrote: > > One thing that Tsung, recording > > queries as proxy, will never be able to handle are encrypted connections, > > but I guess that's a minor problem. > > Yes, because you typically run the proxy only to record sessions, in > order to prepare the tsung setup. Another way

Re: [GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Sergio Ramazzina
Hi Scott, here's the trigger and the function CREATE OR REPLACE FUNCTION tpm_wind_dcn_insert_trigger() RETURNS TRIGGER AS $$ BEGIN IF ( NEW.data >= DATE '2010-01-01' AND NEW.data < DATE '2010-01-02' ) THEN INSERT INTO tp_wind_dcn_day1 VALUES (NEW.*); ELSIF ( NEW.data >= DATE '2010

Re: [GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Scott Mead
On Tue, Mar 23, 2010 at 4:23 AM, Sergio Ramazzina wrote: > Hi everybody, > > I'm new to postgresql and I need some help to understand the behaviour of > before insert triggers in postgresql. I'm trying the sample > documented in the user manual about implementing table partitions ( > http://www.po

Re: [GENERAL] strange

2010-03-23 Thread Grzegorz Jaśkiewicz
2010/3/23 Filip Rembiałkowski > For the record, I've recently observed such behaviour on non-cheap > 64bit server harware. > > That was Pg 8.4.0. hardware specs available on request. > > EXPLAIN ANALYZE SELECT was over 2 times slower that SELECT. repeatedly. > > Answering an obligatory question:

Re: [GENERAL] strange

2010-03-23 Thread Filip Rembiałkowski
For the record, I've recently observed such behaviour on non-cheap 64bit server harware. That was Pg 8.4.0. hardware specs available on request. EXPLAIN ANALYZE SELECT was over 2 times slower that SELECT. repeatedly. Answering an obligatory question: NO virtualization (vmware/xen/other) there.

Re: [GENERAL] Creating a view: ERROR: rules on SELECT must have action INSTEAD SELECT

2010-03-23 Thread Filip Rembiałkowski
David, You cannot mix CREATE TEMP TABLE and SELECT in one CREATE VIEW statement I really recommend looking at WITH statement http://www.postgresql.org/docs/8.4/static/queries-with.html Adjusting to your example: CREATE VIEW test_view AS WITH q AS ( SELECT 2 as two, 3 as three ) SELECT *, two+th

Re: [GENERAL] pgreplay log file replayer released

2010-03-23 Thread Dimitri Fontaine
"Albe Laurenz" writes: > It seems that Tsung currently only supports "basic queries", but I > assume that this can be improved. In fact from the time when PostgreSQL support was added, some more Erlang drivers have appeared and some of them covers the entire protocol. So it should be possible to

Re: [GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread A. Kretschmer
In response to Tuo Pe : > Hello! > > I am teaching myself PL/pgSQL. I am trying to write a function that tests > whether two time periods overlap. I want to test the function parameters > against these two values in "overlaptest" table: > > select * from overlaptest; > id |alku

[GENERAL] PL/pgSQL & OVERLAPS operator

2010-03-23 Thread Tuo Pe
Hello! I am teaching myself PL/pgSQL. I am trying to write a function that tests whether two time periods overlap. I want to test the function parameters against these two values in "overlaptest" table: select * from overlaptest; id |alku |loppu +---

Re: [GENERAL] db error messages when I try to debug with pgadmin

2010-03-23 Thread josep porres
I solved this issue creating the functions again using the script pldbgapi.sql in http://pgfoundry.org/frs/download.php/1916/edb-debugger-0.93.tgz thanks for your support josep 2010/3/17 josep porres > > Hi guys, > > > I cannot debug with pgadmin 1.10.2, I get an error in both debugging > opti

[GENERAL] Before triggers and usage in partitioned tables

2010-03-23 Thread Sergio Ramazzina
Hi everybody, I'm new to postgresql and I need some help to understand the behaviour of before insert triggers in postgresql. I'm trying the sample documented in the user manual about implementing table partitions ( http://www.postgresql.org/docs/8.4/interactive/ddl-partitioning.html) and I've a p

Re: [GENERAL] pgreplay log file replayer released

2010-03-23 Thread Albe Laurenz
Dimitri Fontaine wrote: > Greg Stark writes: >> Do you have a multi-threaded model that tracks which transactions each >> query belonged to and runs them concurrently like they were in the >> original setup? That's what I've been looking for. > > Tsung does that and has been doing it for… quite s