[GENERAL] Efficiently obtaining (any) one record per group.

2010-07-23 Thread Allan Kamau
Hi all, I have a large table that contains redundancies as per one field. I am looking for a way to identify (or extract) a non redundant set of rows ( _any_ one record per group) from this table and for each record of this "distinct" set of rows, I would like to capture it's other fields. Below

Re: [GENERAL] Problem with pg_try_advisory_lock and two connections (seemingly) getting the same lock

2010-07-23 Thread Craig Ringer
On 24/07/10 00:00, Merlin Moncure wrote: > I generally agree with your statements, but there is one correction to > make: advisory locks are not released at end of transaction. Argh. Good point. Every other kind of lock is, but advisory locks are only released when the connection is closed or the

Re: [GENERAL] prepared statements

2010-07-23 Thread Scott Frankel
Works! The bug in my example was not passing the INSERT statement an explicit list of column names, as per any non-prepared insert. Thanks! Scott On Jul 23, 2010, at 2:53 PM, Daniel Verite wrote: Scott Frankel wrote: I've found that, for a table with a serial sequence key as it

Re: [GENERAL] JASPA (JAva SPATial) for PostgreSQL and H2 released

2010-07-23 Thread John R Pierce
On 07/23/10 3:48 PM, Kerry Sainsbury wrote: Is it really GPL? Any code I write that uses JASPA must also be GPL'ed? Shouldn't it be LGPL? IANAL, but if this is PL/Java based, then your code shouldn't need to be GPL as you're not linking with it, you're just 'using' it. Now, if you make any

Re: [GENERAL] JASPA (JAva SPATial) for PostgreSQL and H2 released

2010-07-23 Thread Kerry Sainsbury
Is it really GPL? Any code I write that uses JASPA must also be GPL'ed? Shouldn't it be LGPL? 2010/7/24 Jose C. Martinez-Llario > (sorry for the cross posting) > > * text in english ** > > After one year of development, we are pleased to announce the release

[GENERAL] pg_dump, shemas, backup strategy

2010-07-23 Thread Michael A. Peters
I've been using MySQL for years. I switched (er, mostly) to PostgreSQL recently because I need to use PostGIS. It is all working now for the most part, and PostGIS is absolutely wonderful. I run CentOS 5.x and I do not like to upgrade vendor supplied packages. My version of pg_dump is from postgre

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Alvaro Herrera
Excerpts from Steeles's message of vie jul 23 12:36:41 -0400 2010: > Thanks for the quick reply. > > so if I switch target database from recovery mode to normal mode and do > pg_dump to backup, then switch it back to recovery mode. The only way to switch back is to have a prior filesystem-level s

Re: [GENERAL] Finding last checkpoint time

2010-07-23 Thread Alvaro Herrera
Excerpts from Greg Sabino Mullane's message of vie jul 23 19:08:27 UTC 2010: > > Hash: RIPEMD160 > > > Hmm, wouldn't have it been easier to set LC_MESSAGES to C before > > calling pg_controldata? > > To be honest, I can't remember why that wasn't working for me when > I tried it some time ago.

Re: [GENERAL] prepared statements

2010-07-23 Thread Daniel Verite
Scott Frankel wrote: > I've found that, for a table with a > serial sequence key as its first column, I have to specify the key in > my prepared statement or I get type errors: ERROR: column "foo_id" > is of type integer but expression is of type character varying. Let's try: tes

[GENERAL] Prefix LIKE search and indexes issue.

2010-07-23 Thread Marcelo de Moraes Serpa
Hello list, So, I have a small query design issue and I'd like to borrow some of your wisdom. Let's say I a users relation, and each user has a reversed_domain field. id | name | reversed_domain 1Josh com.app ... I then have a firefox plugin which makes request to my application serve

Re: [GENERAL] Question about SCO openserver and postgres...

2010-07-23 Thread Ireneusz Pluta
Edmundo Robles L. pisze: On 07/22/2010 05:39 PM, Scott Marlowe wrote: On Thu, Jul 22, 2010 at 3:24 PM, Edmundo Robles L. wrote: Hi! I have a problem with the max postgres connections on SCO Openserver 5.0.7, so ...my boss decided to buy the SCO Openserver 6.0 but this vers

Re: [GENERAL] Finding last checkpoint time

2010-07-23 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > Hmm, wouldn't have it been easier to set LC_MESSAGES to C before > calling pg_controldata? To be honest, I can't remember why that wasn't working for me when I tried it some time ago. I just verified that it *will* work, however, when I se

Re: [GENERAL] How to improve performance in reporting database?

2010-07-23 Thread Vick Khera
On Thu, Jul 22, 2010 at 2:31 PM, Greg Smith wrote: > You can build those manually with PostgreSQL if you really want them: >  http://wiki.postgresql.org/wiki/Materialized_Views > Another thing to consider... In our case we use a materialized view to keep track of counts of various things that are

Re: [GENERAL] How to distribute quantity if same product is in multiple rows

2010-07-23 Thread Andrus Moor
Tim, Thank you. It can be done in SQL: "SUM(kogus) OVER (PARTITION BY toode ORDER BY ID) - kogus" (*1) will give you the running sum of the product up to that row. You can then subtract that value from the delivered quantity to calculate the delivered quan- tity for the current row. I tried t

[GENERAL] Blocked inserts on tables with FK to tables for which UPDATE has been revoked

2010-07-23 Thread Samuel Gilbert
Hello, I have encountered a problem with inserts failing because of permissions issues when the table in which I try to insert has foreign key constraints to tables for which UPDATE has been revoked. The script bellow show how to reproduce the problem with a bare-bones test case. Reproducib

[GENERAL] prepared statements

2010-07-23 Thread Scott Frankel
Hi all, I'm working with prepared statements directly in pg for the first time and have a couple of questions. Does a prepared statement used to insert into a table need to insert into all columns of the table? I've found that, for a table with a serial sequence key as its first column,

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Greg Smith
Steeles wrote: also, once the target PG database receives WAL files and update its own database, can I run pg_dump to dump all the data when it is in recovery mode? Not while it's in recovery mode. If you upgrade to the soon to be released PostgreSQL 9.0, it's possible to bring the server up

Re: [GENERAL] Finding last checkpoint time

2010-07-23 Thread Alvaro Herrera
Excerpts from Greg Sabino Mullane's message of jue jul 22 13:34:25 UTC 2010: > > -BEGIN PGP SIGNED MESSAGE- > Hash: RIPEMD160 > > > Or you can use pg_controldata /path/to/pgdata and look > > at "Time of latest checkpoint". > > Assuming your system is using English. Otherwise, you'll >

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Adrian Klaver
On 07/23/2010 09:31 AM, Magnus Hagander wrote: On Fri, Jul 23, 2010 at 18:29, Steeles wrote: I am working on shipping WAL files, can WAL files do one-to-many shipping? The target PG instances are running in the recovery mode waiting for the WAL files. Yes. Just copy the files to multiple mach

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Magnus Hagander
On Fri, Jul 23, 2010 at 18:36, Steeles wrote: > Thanks for the quick reply. > > so if I switch target database from recovery mode to normal mode and do > pg_dump to backup, then switch it back to recovery mode. You can't switch back. Well, you can - by setting up the replication again from scrat

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread John R Pierce
the universal solution is a AND with one mask (which has a 1 in every position you wish to test for and a zero in each position you wish to ignore) and an XOR with another mask (that has a 1 in each position that you want to test for a 1 and a zero in each position that you wish to test for

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Steeles
Thanks for the quick reply. so if I switch target database from recovery mode to normal mode and do pg_dump to backup, then switch it back to recovery mode. Will it break the relationship between source and target? Do I need to re-configure it in order to receive the WAL files? On Fri, Jul 23,

Re: [GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Magnus Hagander
On Fri, Jul 23, 2010 at 18:29, Steeles wrote: > I am working on shipping WAL files, can WAL files do one-to-many shipping? > The target PG instances are running in the recovery mode waiting for the WAL > files. Yes. Just copy the files to multiple machines, the slaves are completely independent.

[GENERAL] Can WAL files be shipped to multiple servers?

2010-07-23 Thread Steeles
I am working on shipping WAL files, can WAL files do one-to-many shipping? The target PG instances are running in the recovery mode waiting for the WAL files. also, once the target PG database receives WAL files and update its own database, can I run pg_dump to dump all the data when it is in reco

Re: [GENERAL] Question about SCO openserver and postgres...

2010-07-23 Thread Scott Marlowe
On Fri, Jul 23, 2010 at 7:42 AM, Edmundo Robles L. wrote: > > On 07/22/2010 05:39 PM, Scott Marlowe wrote: >> On Thu, Jul 22, 2010 at 3:24 PM, Edmundo Robles L. >>  wrote: >> >>> Hi! >>>   I have a problem with the  max  postgres connections  on SCO >>> Openserver 5.0.7, so ...my boss decided to

Re: [GENERAL] psql problem

2010-07-23 Thread Gary Fu
On 07/22/2010 09:02 PM, Andy Colson wrote: On 07/22/2010 04:03 PM, Gary Fu wrote: Hi, System information: - psql 8.4.4 on a client with CentOS 5.5 (64 bits) - postgres 8.4.4 on the server with CentOS 5.5 (64 bits) - the client is connected with vpn I have a script to create a table with some c

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Scott Marlowe
On Fri, Jul 23, 2010 at 10:04 AM, Greg Smith wrote: > P.S. This little "I've been doing this for X long" pissing game is going to > end making everyone look like n00bs when Tom gets back. No pissing match on my end. I honestly feel more comfortable working with these kinds of things in binary th

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Greg Smith
Howard Rogers wrote: That's the point: you've assumed something you needn't have. You seem to have assumed that Scott was trying to be a jerk here, when he was just trying to help you out by suggesting a feature in PostgreSQL you may not have been familiar with, one that makes this particu

Re: [GENERAL] Problem with pg_try_advisory_lock and two connections (seemingly) getting the same lock

2010-07-23 Thread Merlin Moncure
On Tue, Jul 20, 2010 at 10:52 PM, Craig Ringer wrote: > On 21/07/10 07:27, Brett Hoerner wrote: > >> Here is an example query, >> >> SELECT q.* >> FROM (SELECT id, job, arg >>       FROM queue >>       WHERE job = 'foo' OR job = 'bar' >>       OFFSET 0) AS q >> WHERE pg_try_advisory_lock(1, q.id)

Re: [GENERAL] Finding last checkpoint time

2010-07-23 Thread Greg Smith
Devrim GÜNDÜZ wrote: What about adding a column to pg_stat_bgwriter, like "last_checkpoint" or similar? If you look at the messages I linked to, you'll find that's one of the ideas that's been proposed and shot down. We even had a patch... -- Greg Smith 2ndQuadrant US Baltimore, MD Pos

Re: [GENERAL] Information Extract

2010-07-23 Thread Greg Smith
Please don't ever post the same question to multiple lists like you've done here with this one again. The suggested practice for the postgresql.org lists is to try the most appropriate list with a question, then consider asking on another list only if you haven't gotten any responses after a d

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Howard Rogers
On Fri, Jul 23, 2010 at 6:17 PM, Alban Hertroys wrote: >> I thought to do >> >> select * from coloursample where colour & 10 = 10; >> >> ...but that's not right, because it finds the third record is a match. > > > What's not entirely clear to me is whether you only want to find colours that > hav

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Howard Rogers
> Hate to interrupt your flame war, and I apologize for not being precise in > my meaning first try... You don't need any bitwise anything to compare two > bitmasks-hiding-in-integers, just check for equality. > > Instead of "select * from coloursample where colour & 10 = 10;" just try > "select *

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Howard Rogers
On Fri, Jul 23, 2010 at 7:57 PM, Stephen Cook wrote: > On 7/23/2010 5:33 AM, Howard Rogers wrote: >> >> ...so select * from table where 21205 | 4097 = 21205 would correctly >> grab that record. So I'm assuming you mean the 'stored value' should >> be on both sides of the equals test. If so, that w

[GENERAL] JASPA (JAva SPATial) for PostgreSQL and H2 released

2010-07-23 Thread Jose C. Martinez-Llario
(sorry for the cross posting) * text in english ** After one year of development, we are pleased to announce the release 0.1RC1 of JASPA (JAva SPAtial). JASPA potentially brings around 200 spatial functions to any relational database system that supports a

Re: [GENERAL] optimizing daily data storage in Pg

2010-07-23 Thread Andy Colson
On 7/23/2010 12:39 AM, P Kishor wrote: On Thu, Jul 22, 2010 at 4:56 PM, Andy Colson wrote: On 7/22/2010 9:41 AM, P Kishor wrote: I have been struggling with this for a while now, have even gone down a few paths but struck out, so I turn now to the community for ideas. First, the problem: Stor

Re: [GENERAL] Question about SCO openserver and postgres...

2010-07-23 Thread Edmundo Robles L.
On 07/22/2010 05:39 PM, Scott Marlowe wrote: > On Thu, Jul 22, 2010 at 3:24 PM, Edmundo Robles L. > wrote: > >> Hi! >> I have a problem with the max postgres connections on SCO >> Openserver 5.0.7, so ...my boss decided to buy the SCO Openserver 6.0 >> but this version comes in 2 e

Re: [GENERAL] Difference between EXPLAIN ANALYZE SELECT ... total runtime and SELECT ... runtime

2010-07-23 Thread Piotr Gasidło
W dniu 23 lipca 2010 10:51 użytkownik Piotr Gasidło napisał: > 2010/7/23 A. Kretschmer : >> Maybe cheaply or virtuell hardware? > (...) >> There are some issues with functions >> like gettimoofday(), see here: > (..) Just tested it on my workstation. No vserver. The same result. EXPLAIN ANALYZE

Re: [GENERAL] index scan and functions

2010-07-23 Thread arno
Le mardi 20 juillet 2010, à 10:11:21 +0200, Harald a écrit : > In article <20100719162547.ga17...@localhost>, > arno writes: > > > Thanks, that's exactly what I was looking for. > > No, I'd say you're looking for the ip4r package which provides > an indexable IP address range type. Thanks, I'l

Re: [GENERAL] Data dumps to files - best methods?

2010-07-23 Thread Machiel Richards
Thank you very much, I think this will help a lot. Will ask for more details once I receive the full specs,etc... Machiel Richards MySQL DBA Email: machi...@rdc.co.za Tel: 0861 732 732 RDC_Logo From: Ralf Schuchardt [mailto:r...@gmx.de] Sent: 23 July 2010 01:37 PM To: Mach

Re: [GENERAL] Data dumps to files - best methods?

2010-07-23 Thread Ralf Schuchardt
Hi, Am 23.07.2010 um 10:32 schrieb Machiel Richards: >As I am fairly new to postgresql I am trying to find some more info > regarding options to dump specific data to files. > However, even though I can get the sql query,etc... how will I use this > to dump the data into the rele

Re: [GENERAL] Centos 5.5 and Postgres 9.0.beta3 install errors

2010-07-23 Thread Tom Robst
Hi Devrim, Thank you for your reply...I've run an yum clean all and re-installed the pgdg-centos-9.0-2.noarch rpm but now I'm getting this error: http://yum.pgrpms.org/9.0/redhat/rhel-5-i386/postgresql-libs-9.0-beta3_1PGDG.rhel5.i386.rpm: [Errno -1] Package does not match intended download

Re: [GENERAL] Centos 5.5 and Postgres 9.0.beta3 install errors

2010-07-23 Thread Devrim GÜNDÜZ
On Fri, 2010-07-23 at 10:50 +0100, Tom Robst wrote: > > Can anyone help me with the errors I seem to be having installing the > latest Postgresql 9.0 beta 3 rpms from the PGDG-9.0 repository on > Centos > 5.5? > > I am having dependency issues: > > Error: Missing Dependency: libpq.so.4 is need

[GENERAL] Centos 5.5 and Postgres 9.0.beta3 install errors

2010-07-23 Thread Tom Robst
Dear all, Can anyone help me with the errors I seem to be having installing the latest Postgresql 9.0 beta 3 rpms from the PGDG-9.0 repository on Centos 5.5? I am having dependency issues: Error: Missing Dependency: libpq.so.4 is needed by package postgresql-libs-9.0-beta3_1PGDG.el5.i386 (p

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Stephen Cook
On 7/23/2010 5:33 AM, Howard Rogers wrote: ...so select * from table where 21205 | 4097 = 21205 would correctly grab that record. So I'm assuming you mean the 'stored value' should be on both sides of the equals test. If so, that would indeed seem to be the ultimate answer to the question (though

[GENERAL] Data dumps to files - best methods?

2010-07-23 Thread Machiel Richards
Good day all As I am fairly new to postgresql I am trying to find some more info regarding options to dump specific data to files. Let me give you guys some idea on what I mean by this Currently there is a java/perl process that runs and creates datadumps for clien

Re: [GENERAL] Difference between EXPLAIN ANALYZE SELECT ... total runtime and SELECT ... runtime

2010-07-23 Thread Piotr Gasidło
2010/7/23 A. Kretschmer : > Maybe cheaply or virtuell hardware? Cheap - probably, I known processor, but don't know mainboard. It's dedicated server. Maybe it has silent problems with time keeping. Virtual - also yes. Postgresql run in separate vserver, but I've executed psql also from that vserve

Re: [GENERAL] Finding last checkpoint time

2010-07-23 Thread Devrim GÜNDÜZ
On Tue, 2010-07-20 at 16:15 -0400, Greg Smith wrote: > Devrim GÜNDÜZ wrote: > > Is there a way to find last checkpoint time via SQL command? I know I > > can grep xlogs by turning on log_checkpoints, but I'd prefer an SQL > > solution. > > > > Not directly. Best you can do without linking in n

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Alban Hertroys
> I thought to do > > select * from coloursample where colour & 10 = 10; > > ...but that's not right, because it finds the third record is a match. What's not entirely clear to me is whether you only want to find colours that have BOTH Yellow and Orange set and nothing else, or colours that ha

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Stephen Cook
On 7/23/2010 2:38 AM, Howard Rogers wrote: Still doesn't answer the precise, specific technical question I >> actually asked, though, does it?! > > Which was answered by Stephen Cook was it not? I.e. use plain old equals? Maybe I should assume you haven't read the thread, then?! God knows wh

Re: [GENERAL] Bitmask trickiness

2010-07-23 Thread Howard Rogers
On Fri, Jul 23, 2010 at 3:02 PM, Scott Marlowe wrote: >> If you mean, did I read the bit in the doco where it said nothing at >> all in the 'these are great advantages' style I've just described, but >> instead makes the fairly obvious point that a bit string takes 8 bits >> to store a group of 8