Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Thomas Kellerer
Grant Mckenzie wrote on 20.11.2010 07:00: How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's key does not exist in the database else update the existing row? You can simply send the UPDATE, if nothing was updated, it's safe to

Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Ashish Karalkar
On 11/20/2010 02:43 PM, Thomas Kellerer wrote: Grant Mckenzie wrote on 20.11.2010 07:00: How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's key does not exist in the database else update the existing row? You can simply send

Re: [GENERAL] The first dedicated PostgreSQL forum

2010-11-20 Thread Radosław Smogura
Hi, As has been said previously, an unlinked forum (one which has no interaction with the mailing list) is destined to fail, as others have in the past. It's creates a fragmented community and poor support on such a forum would reflect badly on the PostgreSQL community. Mailing lists

Re: [GENERAL] Survey on backing up unlogged tables: help us with PostgreSQL development!

2010-11-20 Thread Ron Mayer
Josh Berkus wrote: With the current patches, the data survives a restart just fine. Per -hackers, that's not guarenteed. Not guaranteed is fine. What people are asking for is often survives. AFAIK we don't truncate the log file created by the log_filename GUC on every unclean crash and every

[GENERAL] Fwd: [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
On 20/11/2010, at 9:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 02:57, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 3:58 AM, Magnus Hagander wrote: On Fri, Nov 19, 2010 at 16:14, Alvaro Herrera alvhe...@commandprompt.com wrote: Excerpts from Dave Page's

[GENERAL] Fwd: [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
On 20/11/2010, at 4:04 AM, Alvaro Herrera wrote: Excerpts from Dave Page's message of vie nov 19 12:22:09 -0300 2010: On Fri, Nov 19, 2010 at 3:14 PM, Alvaro Herrera alvhe...@commandprompt.com wrote: I wonder if the mailing list would alow posting from an address like

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
On 20/11/2010, at 11:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 12:26, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 9:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 02:57, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 3:58 AM, Magnus

[GENERAL] Fwd: [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
Begin forwarded message: From: Magnus Hagander mag...@hagander.net Date: 20 November 2010 3:58:41 AM AEDT To: Alvaro Herrera alvhe...@commandprompt.com Cc: Dave Page dp...@pgadmin.org, Elliot Chance elliotcha...@gmail.com, pgsql-www pgsql-...@postgresql.org Subject: Re: [pgsql-www]

Fwd: [GENERAL] The first dedicated PostgreSQL forum

2010-11-20 Thread Elliot Chance
Apple Mail has not been copying the mailing list, so excuse the reposts if you got one. Begin forwarded message: From: Elliot Chance elliotcha...@gmail.com Date: 19 November 2010 9:18:18 AM AEDT To: Daniel Verite dan...@manitou-mail.org Subject: Re: [GENERAL] The first dedicated PostgreSQL

Fwd: [GENERAL] Postgres forums ... take 2

2010-11-20 Thread Elliot Chance
Apple Mail has not been copying the mailing list, so excuse the reposts if you got one. Begin forwarded message: From: Elliot Chance elliotcha...@gmail.com Date: 15 November 2010 9:02:43 PM AEDT To: Thom Brown t...@linux.com Subject: Re: [GENERAL] Postgres forums ... take 2 On

Fwd: [GENERAL] Postgres forums ... take 2

2010-11-20 Thread Elliot Chance
Apple Mail has not been copying the mailing list, so excuse the reposts if you got one. Begin forwarded message: From: Elliot Chance elliotcha...@gmail.com Date: 16 November 2010 4:57:27 PM AEDT To: Craig Ringer cr...@postnewspapers.com.au Subject: Re: [GENERAL] Postgres forums ... take 2

[GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Alexander Farber
Hello, I'm trying to program a PHP-script, where users can rate the goodness of the other players: create table pref_rep ( id varchar(32) references pref_users(id) check (id author), author varchar(32) references pref_users(id), author_ip

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Magnus Hagander
On Sat, Nov 20, 2010 at 14:22, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 11:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 12:26, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 9:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 02:57, Elliot

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
Using the reply to all, thanks. On 21/11/2010, at 12:32 AM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 14:22, Elliot Chance elliotcha...@gmail.com wrote: On 20/11/2010, at 11:52 PM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 12:26, Elliot Chance elliotcha...@gmail.com wrote: On

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Dmitriy Igrishin
Hey Alexander, 2010/11/20 Alexander Farber alexander.far...@gmail.com Hello, I'm trying to program a PHP-script, where users can rate the goodness of the other players: create table pref_rep ( id varchar(32) references pref_users(id) check (id author),

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Alexander Farber
I'm actually hoping to use inet (or cidr?) instead of strings... On 11/20/10, Dmitriy Igrishin dmit...@gmail.com wrote: Hey Alexander, 2010/11/20 Alexander Farber alexander.far...@gmail.com Hello, I'm trying to program a PHP-script, where users can rate the goodness of the other

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Dmitriy Igrishin
You can. host() just extract IP address from a value of inet type as text, string_to_array() converts this text to text[], and it makes it possible to compare with another text[]... I see no problem here. It works just fine. But probably there is another (better) solution... 2010/11/20 Alexander

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Alexander Farber
I think inet is a number internally, there is probably a more effective way... On 11/20/10, Dmitriy Igrishin dmit...@gmail.com wrote: You can. host() just extract IP address from a value of inet type as text, string_to_array() converts this text to text[], and it makes it possible to compare

Re: [GENERAL] where is pg_stat_activity (and others) in the documentation?

2010-11-20 Thread Scott Mead
On Mon, Nov 15, 2010 at 10:03 AM, Vick Khera vi...@khera.org wrote: On Mon, Nov 15, 2010 at 5:15 AM, Willy-Bas Loos willy...@gmail.com wrote: I was looking for what exactly waiting means in pg_stat_activity. You can find out exactly what you're waiting for by correlating this to the

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Dmitriy Igrishin
I will be glad to see the best solution, so if you find it please share. :-) But you want to compare IP addresses by 3 first parts. I don't see any function or operator at SQL level which allow to do it without converting to text. Probably, you can do it by manipulating a binary form (from

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Magnus Hagander
On Sat, Nov 20, 2010 at 14:46, Elliot Chance elliotcha...@gmail.com wrote: for...@postgresql.com.au is pointed to a black hole so that email disappears but the mailing list gets another copy. When the mailing list gets its copy it sends a copy to the forum (because the forum is just like a

Re: [GENERAL] Fwd: [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Tom Lane
Elliot Chance elliotcha...@gmail.com writes: Then I can create a catch-all so that when an email is sent to forums-chan...@postgresql.com.au it finds the user chancey gets the real address and sends it on. If there were a way we could register a range for mj2 like accept all emails from

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Tom Lane
Alexander Farber alexander.far...@gmail.com writes: 1) if I'd like to compare just the first 3 numbers of the IP address instead of the 4, how can I do it? regression=# select network(set_masklen('123.45.67.42'::inet, 24)) = regression-# network(set_masklen('123.45.67.56'::inet, 24));

Re: [GENERAL] Postgres forums ... take 2

2010-11-20 Thread Bruce Momjian
Stephen Cook wrote: On 11/16/2010 10:51 AM, Magnus Hagander wrote: What I'm more interested in is still a word from the people who would actually *use* a forum on how this would be better than sites like Nabble and Gmane. I'm one of those. I'm subscribed to these mailing lists simply

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Bruce Momjian
Magnus Hagander wrote: On Sat, Nov 20, 2010 at 14:46, Elliot Chance elliotcha...@gmail.com wrote: for...@postgresql.com.au is pointed to a black hole so that email disappears but the mailing list gets another copy. When the mailing list gets its copy it sends a copy to the forum (because

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Alexander Farber
Thank you. Or maybe also? (author_ip '255.255.255.0'::inet) = (_author_ip '255.255.255.0'::inet) On Sat, Nov 20, 2010 at 4:47 PM, Tom Lane t...@sss.pgh.pa.us wrote: Alexander Farber alexander.far...@gmail.com writes: 1) if I'd like to compare just the first 3 numbers of the IP address

Re: [GENERAL] Survey on backing up unlogged tables: help us with PostgreSQL development!

2010-11-20 Thread Josh Berkus
AFAIK we don't truncate the log file created by the log_filename GUC on every unclean crash and every clean shutdown. That's not a remotely relevant analogy. A log file is not a database table. If we allow a database table to become corrupted due to being unsynched at the time of shutdown,

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-20 Thread Dmitriy Igrishin
Hey Tom, Thanks for you solution! 2010/11/20 Tom Lane t...@sss.pgh.pa.us Alexander Farber alexander.far...@gmail.com writes: 1) if I'd like to compare just the first 3 numbers of the IP address instead of the 4, how can I do it? regression=# select

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Trevor Talbot
On Sat, Nov 20, 2010 at 05:46, Elliot Chance elliotcha...@gmail.com wrote: On 21/11/2010, at 12:32 AM, Magnus Hagander wrote: On Sat, Nov 20, 2010 at 14:22, Elliot Chance elliotcha...@gmail.com wrote: Use Reply To All when you want to send to the list. It's what everybody else has been

Re: [GENERAL] Fwd: [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Elliot Chance
On 21/11/2010, at 2:41 AM, Tom Lane wrote: Elliot Chance elliotcha...@gmail.com writes: Then I can create a catch-all so that when an email is sent to forums-chan...@postgresql.com.au it finds the user chancey gets the real address and sends it on. If there were a way we could register a

Re: Fwd: [GENERAL] Postgres forums ... take 2

2010-11-20 Thread Bruce Momjian
Elliot Chance wrote: Also, if someone registers on the forum, do they get a major domo registration email? And if so, would this be set to receive no emails upon registration? I'm not clear as to how this step would work because, at the moment, mailing list subscribers have to

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Michael Glaesemann
On Nov 20, 2010, at 8:22 , Elliot Chance wrote: One very annoying thing about Apple Mail with these lists is that when I hit reply if I don't change the To address to the mailing list or manually add the Cc then it doesn't even get sent to the mailing list. Use Reply to All: Cmd-Shift-R.

Fwd: [GENERAL] The first dedicated PostgreSQL forum

2010-11-20 Thread Elliot Chance
Apple Mail has not been copying the mailing list, so excuse the reposts if you got one. Begin forwarded message: From: Elliot Chance elliotcha...@gmail.com Date: 14 November 2010 12:30:19 PM AEDT To: Tom Lane t...@sss.pgh.pa.us Subject: Re: [GENERAL] The first dedicated PostgreSQL forum

[GENERAL] Cancel a query.

2010-11-20 Thread Rob Brown-Bayliss
Hi I have some code using psycopg in python. Connecting in async mode. I am trying to catch time outs etc, basically after a set amount of time I am assuming something has failed. I then want to use select pg_cancel_backend(15209); to cancel the query. But I can't unless I am connected as the

[GENERAL] shared data for different applications

2010-11-20 Thread Kent Tong
Hi, Let's say that there is some data that should be logically shared by many applications in the company, such as some core information about its customers (name, address, contact info). In principle, such data should be stored in a DB for sharing. But then if a certain application needs to

[GENERAL] shared data for different applications

2010-11-20 Thread Kent Tong
Hi, Let's say that there is some data that should be logically shared by many applications in the company, such as some core information about its customers (name, address, contact info). In principle, such data should be stored in a DB for sharing. But then if a certain application needs to

Re: [GENERAL] newbie question - delete before insert

2010-11-20 Thread Sim Zacks
How do people implement insert or upate ( otherwise known as upsert ) behaviour in postgres i.e. insert a row if it's key does not exist in the database else update the existing row? I tried using an insert rule to delete any existing rows first then insert however this leads to infinitely

[GENERAL] SYSCONFDIR, initdb and postgresql.conf

2010-11-20 Thread KM
On an OpenBSD machine I just compiled and installed 9.0.1. The ./configure arguments included '--sysconfdir=/etc'. Running 'pg_config --sysconfdir' returns '/etc/postgresql'. The cluster is running and I can create a database and connect to it. However, initdb put the config files in the