[GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Edoardo Panfili
I am using this query in 8.3beta4 (compiled from source) in MacOS X 10.5.1 SELECT webName,count(*) FROM contenitore NATURAL JOIN cartellino WHERE contenitore.tipo='e' GROUP BY webName; this is the result webName | count -

Re: [GENERAL] Need help requiring uniqueness in text columns

2008-01-02 Thread Pavel Stehule
Hello IDEA 3: Use two hash functions: CREATE UNIQUE INDEX uidx ON TEST((decode(md5(a),'hex')),(hashtext(a))); removing spaces helps CREATE UNIQUE INDEX uidx ON test((decode(md5(lower(replace(a,' ',''))),'hex'))); Regards Pavel Stehule CREATE UNIQUE INDEX nodups on MESSAGE (my_timestamp_col, m

Re: [GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Pavel Stehule
Hello it works to me: postgres=# create table c1(n varchar, e integer); CREATE TABLE postgres=# create table c2(n2 varchar, e integer); CREATE TABLE postgres=# insert into c1 values('aa',1),('bb',2),('aa',3); INSERT 0 3 postgres=# insert into c2 values('aa',1),('bb',2),('aa',3); INSERT 0 3 postgr

Re: [GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Edoardo Panfili
Pavel Stehule ha scritto: Hello it works to me: postgres=# create table c1(n varchar, e integer); CREATE TABLE postgres=# create table c2(n2 varchar, e integer); CREATE TABLE postgres=# insert into c1 values('aa',1),('bb',2),('aa',3); INSERT 0 3 postgres=# insert into c2 values('aa',1),('bb',2)

Re: [GENERAL] group by and count(*) behaviour in 8.3

2008-01-02 Thread Pavel Stehule
> > > can you send structure and execution plan? > Thank you for your request, the execution plan is the one from > "explain" (I think) but what is the "structure plan"? no, only structure :) table and fields. > The problema was a bug on my import in new database! > > To avoid future error of t

Re: [GENERAL] visibility rules for AFTER UPDATE Constraint Triggers Function

2008-01-02 Thread Richard Broersma Jr
--- On Tue, 1/1/08, Tom Lane <[EMAIL PROTECTED]> wrote: > > Please provide a self-contained example. Basically the example demonstrates the difference a single tuple UPDATE when preformed the following two ways: UPDATE table ...; -- Sees OLD. BEGIN; UPDATE table ...; COMMIT; --Sees NEW. I wa

[GENERAL] Fwd: [ADMIN] Shutting down warm standby server? "

2008-01-02 Thread Glyn Astill
Hi people, I've setup a warm standby reading WAL files, however when I try to shut it down I get the message "server does not shut down". Can someone help please, I presume it has something to do with the server being busy waiting for the next WAL file? What is the correct way to shut do

[GENERAL] Creating XML/KML documents from single tables

2008-01-02 Thread William Temperley
Hi I would be most grateful if someone could help me create an xml doc in the form: -3.04,53.56,0 -2.04,55.56,0 -3.44,57.56,0 This will be created from a single table of point geometries where each belongs to a layer, e.g. x1 or x2 etc. The layer a geometry belongs to is

Re: [GENERAL] Need help requiring uniqueness in text columns

2008-01-02 Thread Matthew Wilson
On Wed 02 Jan 2008 04:23:46 AM EST, Pavel Stehule wrote: > Hello > > IDEA 3: > > Use two hash functions: > > CREATE UNIQUE INDEX uidx ON TEST((decode(md5(a),'hex')),(hashtext(a))); > > removing spaces helps > CREATE UNIQUE INDEX uidx ON test((decode(md5(lower(replace(a,' > ',''))),'hex'))); > > Re

Re: [GENERAL] Need help requiring uniqueness in text columns

2008-01-02 Thread Pavel Stehule
On 02/01/2008, Matthew Wilson <[EMAIL PROTECTED]> wrote: > On Wed 02 Jan 2008 04:23:46 AM EST, Pavel Stehule wrote: > > Hello > > > > IDEA 3: > > > > Use two hash functions: > > > > CREATE UNIQUE INDEX uidx ON TEST((decode(md5(a),'hex')),(hashtext(a))); > > > > removing spaces helps > > CREATE UNIQ

Re: [GENERAL] Creating XML/KML documents from single tables

2008-01-02 Thread Pavel Stehule
Hello you have to use xmlagg function Regards Pavel Stehule On 02/01/2008, William Temperley <[EMAIL PROTECTED]> wrote: > Hi > I would be most grateful if someone could help me create an xml doc in the > form: > > > > class="1">-3.04,53.56,0 > class="4">-2.04,55.56,0 > > >

Re: [GENERAL] basic questions: Postgres with yum on CentOS 5.1

2008-01-02 Thread Andrew Sullivan
Along with the other good remarks people have made, I want to point something out. On Tue, Jan 01, 2008 at 06:49:40PM -0800, Chuck wrote: > > I created a test database and confirmed that it's created with > 'SQL_ASCII' encoding. > [EMAIL PROTECTED] ~]# sudo -u postgres createdb myTest > could no

[GENERAL] Table auditing / Pg/tcl help

2008-01-02 Thread Glyn Astill
Hi people, I've been trying to set up table auditing using a tcl function and a trigger. I followed the guide here to start with: http://www.alberton.info/postgresql_table_audit.html The thing is we have multiple fields in our primary keys so I need to change it to handle them all. I was thinkin

Re: [GENERAL] Any big slony and WAL shipping users?

2008-01-02 Thread Andrew Sullivan
On Fri, Dec 28, 2007 at 12:06:42PM -0500, Josh Harrison wrote: > I also thought abt having 2 setups for backup and replication so that even > when slony fails I will always have the standby server (WAL shipping) to > help me out. Ok, but do realise that what this form of redundancy provides you wi

Re: [GENERAL] [HACKERS] Slow count(*)

2008-01-02 Thread Pavel Stehule
On 02/01/2008, Abraham, Danny <[EMAIL PROTECTED]> wrote: > When comparing the OLTP part of our product, PG is about 15% slower > compared to Oracle, which is reasonable. > > When comparing the DSS part, it is about 20 times slower. > > Unfortunately, we need both. > Send slow queries, please, and

[GENERAL] tablefunc and crosstab

2008-01-02 Thread Vincent Bernat
Hi ! I am trying to use crosstab function from tablefunc. SELECT * from crosstab('select date, source, name, value FROM cth ORDER by 1', 'select distinct name from cth order by 1') AS ct(date timestamp, source text, val1 text, val2 text, val3 text, val4 text, val5 text); The content of the tabl

Re: [GENERAL] visibility rules for AFTER UPDATE Constraint Triggers Function

2008-01-02 Thread Tom Lane
Richard Broersma Jr <[EMAIL PROTECTED]> writes: > --- On Tue, 1/1/08, Tom Lane <[EMAIL PROTECTED]> wrote: >> Please provide a self-contained example. > Basically the example demonstrates the difference a single tuple UPDATE when > preformed the following two ways: > UPDATE table ...; -- Sees OL

Re: [GENERAL] Hinting the planner

2008-01-02 Thread Chris Browne
[EMAIL PROTECTED] (Martin Gainty) writes: > Not the planner but you can hint the query as in this example > select /*+ ordered use_hash(code1)*/ * from table_1; That might have some effect with Oracle; is there some reason why you think this would be expected to have any effect on a PostgreSQL que

Re: [GENERAL] Fwd: [ADMIN] Shutting down warm standby server? "

2008-01-02 Thread Erik Jones
On Jan 2, 2008, at 7:47 AM, Glyn Astill wrote: Hi people, I've setup a warm standby reading WAL files, however when I try to shut it down I get the message "server does not shut down". Can someone help please, I presume it has something to do with the server being busy waiting for the ne

Re: [GENERAL] [SQL] PG is in different timezone than the OS

2008-01-02 Thread Scott Marlowe
Alright, reading the file in postgresql-8.2.5/src/timezone/README I take it that anyone with a source compiled pg or using source rpms should be able to download the tzdata from here: ftp://elsie.nci.nih.gov/pub/tzcode2007k.tar.gz and put it here: postgresql-8.2.5/src/timezone/data and recomp

Re: [GENERAL] visibility rules for AFTER UPDATE Constraint Triggers Function

2008-01-02 Thread Richard Broersma Jr
--- On Wed, 1/2/08, Tom Lane <[EMAIL PROTECTED]> wrote: > [ pokes at it... ] The reason is that you defined both the trigger and > the testing function as STABLE, which means that they see a snapshot of > the database as of the start of the calling SQL command. In the first > case that's the UPD

[GENERAL] PITR - filter by database?

2008-01-02 Thread Martin Langhoff
Is it possible to segregate the PITR data by database at any stage? We are - taking regular (daily) snapshots straight from the disk - storing WALs - restoring the snapshot - replaying the WALs My guess is that at snapshot time, I could use oid2name to focus on the database I'm interested

Re: [GENERAL] PITR - filter by database?

2008-01-02 Thread Usama Dar
On Jan 3, 2008 2:27 AM, Martin Langhoff <[EMAIL PROTECTED]> wrote: > Is it possible to segregate the PITR data by database at any stage? We are i don't think so. My guess is that at snapshot time, I could use oid2name to focus on the > database I'm interested in plus core Pg data structures,

Re: [GENERAL] replication in Postgres

2008-01-02 Thread Ow Mun Heng
On Mon, 2007-11-26 at 12:39 -0500, Chris Browne wrote: > [EMAIL PROTECTED] ("Jeff Larsen") writes: > Unfortunately, the only way to make things deterministic (or to get > from "near real time" to "*GUARANTEED* real time") is to jump to > synchronous replication, which is not much different from 2P

Re: [GENERAL] Read-only availability of a standby server?

2008-01-02 Thread Ow Mun Heng
On Wed, 2007-11-21 at 15:33 -0500, Andrew Sullivan wrote: > On Wed, Nov 21, 2007 at 12:20:51PM -0800, Garber, Mikhail wrote: > > > In the high-availabilty situation with a warm standby, is it possible (or > > planned) to be able to make standby readable? > > Yes, but it won't happen for 8.3. It