Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Dave Page
On Thu, Jun 11, 2009 at 3:27 AM, Josh Berkusj...@agliodbs.com wrote: On 6/10/09 7:20 PM, Christophe wrote: On Jun 10, 2009, at 6:27 PM, Chris wrote: Can you list the filesizes on http://media.postgresql.org/sfpug/ please? Oh, good idea.  Didn't think of it. Please move the index page to

[GENERAL] When to use cascading deletes?

2009-06-11 Thread David
Hi there. When is a good time to use cascading deletes? Usually, for safety reasons, I prefer to not ever use cascading deletes. But that can lead to some complex code that uses topological sorts etc to manually delete records in the right order, when a cascading delete is needed. Ideally, I'd

[GENERAL] sort by update

2009-06-11 Thread Sim Zacks
The following code works to update a table in order with a sequence. I have tried it on a number of different types of fields. create temporary sequence seq_1; update tbl1 set currentsort=nextval('seq_1') from (select tbl1id from tbl1 order by tbl1id) b where tbl1.tbl1id=b.tbl1id; drop sequence

[GENERAL] Array Parameters in EXECUTE

2009-06-11 Thread Shakil Shaikh
Hi, Here's my general situation: I have a function which takes in an optional ARRAY of Ids as so: RETURN QUERY SELECT * FROM a WHERE a.id = ANY(v_ids) or v_ids is null; However it seems that the ...or v_ids is null... bit forces a sequential scan on a. Reading this list, it seems the best

Re: [GENERAL] Array Parameters in EXECUTE

2009-06-11 Thread Pavel Stehule
Hello 8.4 suport USING clause - so there is possible use array variable directly. regards Pavel Stehule 2009/6/11 Shakil Shaikh ssha...@hotmail.com: Hi, Here's my general situation: I have a function which takes in an optional ARRAY of Ids as so: RETURN QUERY SELECT * FROM a WHERE a.id =

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Alban Hertroys
On Jun 11, 2009, at 10:59 AM, David wrote: Hi there. When is a good time to use cascading deletes? As a general rule of thumb I use cascading deletes if the data in a record is meaningless without the record that the foreign key points to. Ideally, I'd like postgresql to not do

Re: [GENERAL] Array Parameters in EXECUTE

2009-06-11 Thread Shakil Shaikh
Re added list! -- Sent: Thursday, June 11, 2009 11:04 AM To: Shakil Shaikh Subject: Re: [GENERAL] Array Parameters in EXECUTE Here's my general situation: I have a function which takes in an optional ARRAY of Ids as so: RETURN QUERY SELECT *

Re: [GENERAL] Different handling of PL/pgSQL for-loop variables in 8.3.7 vs. 8.2.7 ???

2009-06-11 Thread hubert depesz lubaczewski
On Wed, Jun 10, 2009 at 04:51:44PM -0400, Tom Lane wrote: It's the new implementation. Depending on unspecified implementation details is a good way to have broken code. i'm not sure if it's good change. there might be perfectly good reasons to increment idx from within loop. Best regards,

[GENERAL] queries on xmin

2009-06-11 Thread Matt Amos
the openstreetmap project (http://osm.org/) recently moved from using mysql to postgres and we're trying to improve some of our tools using the new functionality that postgres provides. in particular, we are dumping changes to the database at short intervals (currently every minute, hour and day

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread David
Thanks for the tips, those make sense. I was thinking through this some more after sending my mail, and came to similar conclusions. It would be nice though if this info was more available to people doing research on the subject. Where did you pick up these ideas? At least this thread should

Re: [GENERAL] Different handling of PL/pgSQL for-loop variables in 8.3.7 vs. 8.2.7 ???

2009-06-11 Thread Pavel Stehule
2009/6/11 hubert depesz lubaczewski dep...@depesz.com: On Wed, Jun 10, 2009 at 04:51:44PM -0400, Tom Lane wrote: It's the new implementation.  Depending on unspecified implementation details is a good way to have broken code. i'm not sure if it's good change. there might be perfectly good

Re: [GENERAL] Different handling of PL/pgSQL for-loop variables in 8.3.7 vs. 8.2.7 ???

2009-06-11 Thread hubert depesz lubaczewski
On Thu, Jun 11, 2009 at 12:45:56PM +0200, Pavel Stehule wrote: generally - modification of cycle's control variable isn't good technique, because it's should be broken by some optimizations. When i would argue then that these optimizations are broken, then. you would to modify this some

Re: [GENERAL] queries on xmin

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 11:25 AM, Matt Amoszerebub...@gmail.com wrote: what problems are we going to create for ourselves if we create a btree index on xmin casted to int4? would it be as efficient to use a hash index, create a temporary table of txids that we're querying with a hash index

Re: [GENERAL] queries on xmin

2009-06-11 Thread Marko Kreen
On 6/11/09, Matt Amos zerebub...@gmail.com wrote: the openstreetmap project (http://osm.org/) recently moved from using mysql to postgres and we're trying to improve some of our tools using the new functionality that postgres provides. in particular, we are dumping changes to the database

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Steve Clark
David wrote: Thanks for the tips, those make sense. I was thinking through this some more after sending my mail, and came to similar conclusions. It would be nice though if this info was more available to people doing research on the subject. Where did you pick up these ideas? At least this

Re: [GENERAL] Array Parameters in EXECUTE

2009-06-11 Thread Sim Zacks
Here's my general situation: I have a function which takes in an optional ARRAY of Ids as so: RETURN QUERY SELECT * FROM a WHERE a.id = ANY(v_ids) or v_ids is null; If I understand what you are trying to do, if your passed in parameter is null then select * and if there is something there

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Sim Zacks
I use cascading deletes as per business rule. For example, my customer record has multiple orders and each order can have multiple shipments and multiple payments. My business rule is not to erase a customer with orders, but orders should be erased even if they have shipments or payments. The

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 9:59 AM, Davidwizza...@gmail.com wrote: Ideally, I'd like postgresql to not do cascading deletes, *except* when I tell it to, and the rest of the time fail when the user didn't explicitly opt in for cascading deletes. When it comes to enabling cascading deletes, I

Re: [GENERAL] queries on xmin

2009-06-11 Thread Brett Henderson
Marko Kreen wrote: 4-byte xids on btree may create data corruption. Can you be more specific on this? I'm aware of xid being an unsigned integer which means we need to deal with the cast resulting in negative numbers. This means we have to split our range queries into several pieces when

Re: [GENERAL] Different handling of PL/pgSQL for-loop variables in 8.3.7 vs. 8.2.7 ???

2009-06-11 Thread Pavel Stehule
2009/6/11 hubert depesz lubaczewski dep...@depesz.com: On Thu, Jun 11, 2009 at 12:45:56PM +0200, Pavel Stehule wrote: generally - modification of cycle's control variable isn't good technique, because it's should be broken by some optimizations. When i would argue then that these

Re: [GENERAL] queries on xmin

2009-06-11 Thread Greg Stark
On Thu, Jun 11, 2009 at 12:59 PM, Brett Hendersonbr...@bretth.com wrote: I have a couple of hesitations with using this approach: 1. We can only run the replicator once. 2. We can only run a single replicator. 3. It requires write access to the db. 1 is perhaps the biggest issue.  It means

Re: [GENERAL] queries on xmin

2009-06-11 Thread Brett Henderson
I've been working with Matt on this. Thanks for the suggestions. Greg Stark wrote: On Thu, Jun 11, 2009 at 11:25 AM, Matt Amoszerebub...@gmail.com wrote: what problems are we going to create for ourselves if we create a btree index on xmin casted to int4? would it be as efficient to use a

Re: [GENERAL] queries on xmin

2009-06-11 Thread Matt Amos
On Thu, Jun 11, 2009 at 12:59 PM, Brett Hendersonbr...@bretth.com wrote: Greg Stark wrote: Another option to consider would be including a boolean column dumped defaulted to false. Then you could have a partial index on the primary key or date WHERE NOT dumped. Then when you dump you can

Re: [GENERAL] queries on xmin

2009-06-11 Thread Matt Amos
On Thu, Jun 11, 2009 at 1:13 PM, Brett Hendersonbr...@bretth.com wrote: Marko Kreen wrote: Sorry, I'm not sure what you're suggesting with txid_current().  We're currently using the |txid_current_snapshot|() method which returns us the maximum transaction id plus in-flight transactions.  We

Re: [GENERAL] Postgres Pg_connect PHP

2009-06-11 Thread Dimitri Fontaine
Vyacheslav Kalinin v...@mgcp.com writes: $conn = pg_pconnect(dbname=foo); Please reconsider and use plain pg_connect(). -- dim -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Phil Longstaff
On June 11, 2009 01:21:09 am Albe Laurenz wrote: Phil wrote: I want to develop an app which uses libpq, built with mingw. Is there a download package which contains just the include files/dlls? If not, what package do I download? I don't need the server, just the client libraries. You

Re: [GENERAL] Postgres Pg_connect PHP

2009-06-11 Thread A B
Vyacheslav Kalinin v...@mgcp.com writes:  $conn = pg_pconnect(dbname=foo); Please reconsider and use plain pg_connect(). Would you like to elaborate on that? Why connect and not pconnect? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Phil Longstaff
On June 10, 2009 10:00:48 pm Andy Colson wrote: Phil Longstaff wrote: I want to develop an app which uses libpq, built with mingw. Is there a download package which contains just the include files/dlls? If not, what package do I download? I don't need the server, just the client

Re: [GENERAL] Postgres Pg_connect PHP

2009-06-11 Thread Vyacheslav Kalinin
On Thu, Jun 11, 2009 at 4:36 PM, Dimitri Fontaine dfonta...@hi-media.comwrote: Vyacheslav Kalinin v...@mgcp.com writes: $conn = pg_pconnect(dbname=foo); Please reconsider and use plain pg_connect(). -- dim Uh, I just copied/pasted that part from somewhere in PHP manual, personally I

Re: [GENERAL] queries on xmin

2009-06-11 Thread Marko Kreen
On 6/11/09, Brett Henderson br...@bretth.com wrote: Marko Kreen wrote: 4-byte xids on btree may create data corruption. Can you be more specific on this? I'm aware of xid being an unsigned integer which means we need to deal with the cast resulting in negative numbers. This means we

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Andy Colson
Phil Longstaff wrote: On June 10, 2009 10:00:48 pm Andy Colson wrote: Phil Longstaff wrote: I want to develop an app which uses libpq, built with mingw. Is there a download package which contains just the include files/dlls? If not, what package do I download? I don't need the server,

Re: [GENERAL] queries on xmin

2009-06-11 Thread Marko Kreen
On 6/11/09, Matt Amos zerebub...@gmail.com wrote: On Thu, Jun 11, 2009 at 1:13 PM, Brett Hendersonbr...@bretth.com wrote: See pgq.batch_event_sql() function in Skytools [2] for how to query txids between snapshots efficiently and without being affected by long transactions. I'll

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Vick Khera
On Wed, Jun 10, 2009 at 12:49 PM, Gus Gutoskishared.entanglem...@gmail.com wrote: Of course, the double minus sign comments out the rest of the line and the statement is left dangling, looking for a terminating semicolon. SQL statements are not terminated with semi-colons. The semi-colon is

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Phil Longstaff
I need the include files as well so I can build against the library. Phil From: Andy Colson a...@squeakycode.net To: Phil Longstaff plongst...@rogers.com Cc: pgsql-general@postgresql.org Sent: Thursday, June 11, 2009 9:47:52 AM Subject: Re: [GENERAL] Libpq on

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Andy Colson
Phil Longstaff wrote: On June 11, 2009 01:21:09 am Albe Laurenz wrote: Phil wrote: I want to develop an app which uses libpq, built with mingw. Is there a download package which contains just the include files/dlls? If not, what package do I download? I don't need the server, just the

Re: [GENERAL] Libpq on windows

2009-06-11 Thread Andy Colson
My stuff is in Delphi, so I don't use the .h files, I'm not even sure which one's you'd need. You should grab the source from the main site, it'll have all the .h files you'll ever need. -Andy Phil Longstaff wrote: I need the include files as well so I can build against the library. Phil

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Merlin Moncure
On Wed, Jun 10, 2009 at 12:49 PM, Gus Gutoskishared.entanglem...@gmail.com wrote: Hi, I'm a noob who failed to properly sanitize incoming data from the front end.  As a result, a poor hapless user managed to smuggle in a malicious UPDATE statement that corrupted every single record in a

Re: [GENERAL] [pgsql-general] Daily digest v1.9081 (14 messages)

2009-06-11 Thread David Fetter
On Mon, Jun 08, 2009 at 08:08:02PM +0100, Oliver Kohll - Mailing Lists wrote: On 8 Jun 2009, at 17:23, Merlin Moncure mmonc...@gmail.com wrote: Is there a way when creating a table to limit it to one row? That is, without using a stored procedure? I searched the documentation, but didn't

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Richard Broersma
On Thu, Jun 11, 2009 at 4:44 AM, Greg Starkst...@enterprisedb.com wrote: I generally leave cascade off except for many-to-many mapping tables which contain no additional data and are a pain to manage. Which does sound similar to Alban's rule of thumb. Cascading deletes also make sense for

[GENERAL] Wither 8.3 doc's on cast operator for domain data types?

2009-06-11 Thread Steven Lembark
Using Postgres 8.3.6, trying to run a query with bound parameters gives me: ERROR: XX000: error from Perl function expire_facts: operator does not exist: retire d_date = retired_date at line 56. retired_date is one of a set of domains defined via: create domain publish_date

Re: [GENERAL] Wither 8.3 doc's on cast operator for domain data types?

2009-06-11 Thread Tom Lane
Steven Lembark lemb...@wrkhors.com writes: Using Postgres 8.3.6, trying to run a query with bound parameters gives me: ERROR: XX000: error from Perl function expire_facts: operator does not exist: retire d_date = retired_date at line 56. Uh, maybe you are looking for = rather

[GENERAL] Postgres auditing features

2009-06-11 Thread SHARMILA JOTHIRAJAH
Hi Does postgresql have any build-in auditing features like in Oracle's total-recall or fine grained auditing   http://www.oracle.com/technology/products/database/oracle11g/pdf/total-recall-datasheet.pdf

Re: [GENERAL] queries on xmin

2009-06-11 Thread Matt Amos
On Thu, Jun 11, 2009 at 2:48 PM, Marko Kreenmark...@gmail.com wrote: On 6/11/09, Matt Amos zerebub...@gmail.com wrote: On Thu, Jun 11, 2009 at 1:13 PM, Brett Hendersonbr...@bretth.com wrote:   See pgq.batch_event_sql() function in Skytools [2] for how to   query txids between snapshots

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Eric Schwarzenbach
My rule of thumb for when to use to not use cascading deletes is this: If the what the record represents can essentially be thought of a part of what the record that it references represents, I use cascading deletes. If what the record represents has an independent existence, that it, it does not

Re: [GENERAL] Array Parameters in EXECUTE

2009-06-11 Thread Sim Zacks
You get what you ask for :-) You can use the function array-to-string with a comma as the separator. The array should look like '{val1,val2,val3}' in text format. Sim Shakil Shaikh wrote: Re added list! -- Sent: Thursday, June 11, 2009 11:04

Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Josh Berkus
Dave, Please move the index page to the wiki or pugs site. The media server is *only* supposed to host the files - we don't want any HTML content on there. Oh, ok. I'll put a placeholder page redirecting people. However ... there is the streaming page. That needs to stay somewhere we have

Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Joshua D. Drake
On Thu, 2009-06-11 at 11:13 -0700, Josh Berkus wrote: Dave, Please move the index page to the wiki or pugs site. The media server is *only* supposed to host the files - we don't want any HTML content on there. Oh, ok. I'll put a placeholder page redirecting people. However ...

Re: [GENERAL] queries on xmin

2009-06-11 Thread Marko Kreen
On 6/11/09, Matt Amos zerebub...@gmail.com wrote: On Thu, Jun 11, 2009 at 2:48 PM, Marko Kreenmark...@gmail.com wrote: On 6/11/09, Matt Amos zerebub...@gmail.com wrote: On Thu, Jun 11, 2009 at 1:13 PM, Brett Hendersonbr...@bretth.com wrote: See pgq.batch_event_sql() function in

Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Dave Page
On Thu, Jun 11, 2009 at 7:13 PM, Josh Berkusj...@agliodbs.com wrote: Dave, Please move the index page to the wiki or pugs site. The media server is *only* supposed to host the files - we don't want any HTML content on there. Oh, ok.  I'll put a placeholder page redirecting people. Thanks.

Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Josh Berkus
Josh, Dave, Can you embed the files on the PUGs page like JD suggests? What I want to avoid is an ad-hoc website springing up on media.postgresql.org that ends up in Google and being linked from who-knows-where. Hmmm ... not sure my Drupal-foo is good enough. Will seek help -- Josh

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Gus Gutoski
Thanks for the replies. Tom Lane wrote: This being 8.1, if you haven't turned on autovacuum there is some chance of that. Unfortunately, autovacuum was on. I don't recall ever turning it on, but this database is over two years old; it's possible that I blindly followed advice from pgAdmin or

Re: [GENERAL] Function: Change data while walking through records

2009-06-11 Thread stevesub
Albe Laurenz *EXTERN* wrote: stevesub wrote: I keep having this need to create a function that will change the row data as I am walking through the data. For example, I process each row in order, if column1 change from previous row, set column2 to true. Is this possible? I can run

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Chris Spotts
It's a classic story. I'm volunteering about one day per month for this project, learning SQL as I go. Priority was always given to the get it working tasks and never the make it safe tasks. I had/have grandiose plans to rewrite the whole system properly after I graduate. Unfortunately,

Re: [sfpug] [GENERAL] Rails and PostgreSQL now up on media.postgresql.org

2009-06-11 Thread Joshua D. Drake
On Thu, 2009-06-11 at 11:53 -0700, Josh Berkus wrote: Josh, Dave, Can you embed the files on the PUGs page like JD suggests? What I want to avoid is an ad-hoc website springing up on media.postgresql.org that ends up in Google and being linked from who-knows-where. Hmmm ... not sure my

[GENERAL] listing relations

2009-06-11 Thread Brandon Metcalf
Something interesting I've noticed. If I have a table by the same name in two different schemas, say public and foo, and my search path is set to 'public, foo', \d without an argument lists only the one in public. I see why from the SQL that \d generates, but just wondering why \d doesn't

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Russ Brown
On 06/11/2009 11:33 AM, Eric Schwarzenbach wrote: My rule of thumb for when to use to not use cascading deletes is this: If the what the record represents can essentially be thought of a part of what the record that it references represents, I use cascading deletes. If what the record

Re: [GENERAL] listing relations

2009-06-11 Thread Tom Lane
Brandon Metcalf bran...@geronimoalloys.com writes: Something interesting I've noticed. If I have a table by the same name in two different schemas, say public and foo, and my search path is set to 'public, foo', \d without an argument lists only the one in public. That's intentional. It's

[GENERAL] search for partial dates

2009-06-11 Thread James B. Byrne
Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised query can handle all three circumstances? -- *** E-Mail is NOT a SECURE channel *** James B. Byrne

Re: [GENERAL] search for partial dates

2009-06-11 Thread Christophe
On Jun 11, 2009, at 1:23 PM, James B. Byrne wrote: Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised query can handle all three circumstances? Well, of course, in a

Re: [GENERAL] search for partial dates

2009-06-11 Thread Tom Lane
James B. Byrne byrn...@harte-lyne.ca writes: Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised query can handle all three circumstances? Try date_trunc() ...

Re: [GENERAL] listing relations

2009-06-11 Thread Brandon Metcalf
t == t...@sss.pgh.pa.us writes: t Brandon Metcalf bran...@geronimoalloys.com writes: t Something interesting I've noticed. If I have a table by the same t name in two different schemas, say public and foo, and my search path t is set to 'public, foo', \d without an argument lists only the

Re: [GENERAL] listing relations

2009-06-11 Thread Raymond O'Donnell
On 11/06/2009 21:39, Brandon Metcalf wrote: Is there a \ command to show all tables in the current search path? \dt \? is your friend Ray. -- Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland r...@iol.ie Galway

Re: [GENERAL] listing relations

2009-06-11 Thread Brandon Metcalf
r == r...@iol.ie writes: r On 11/06/2009 21:39, Brandon Metcalf wrote: r Is there a \ command to show all tables in the current search path? r \dt r \? is your friend Nope. You didn't read the entire thread. If you do, you'll see why \dt isn't the answer. I'm well aware of \?.

Re: [GENERAL] search for partial dates

2009-06-11 Thread Scott Marlowe
On Thu, Jun 11, 2009 at 2:35 PM, Tom Lanet...@sss.pgh.pa.us wrote: James B. Byrne byrn...@harte-lyne.ca writes: Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised

Re: [GENERAL] listing relations

2009-06-11 Thread Tom Lane
Brandon Metcalf bran...@geronimoalloys.com writes: Is there a \ command to show all tables in the current search path? Even ones that are masked by earlier search_path entries? No. You could craft some manual query on pg_class, no doubt. regards, tom lane -- Sent via

Re: [GENERAL] listing relations

2009-06-11 Thread Brandon Metcalf
t == t...@sss.pgh.pa.us writes: t Brandon Metcalf bran...@geronimoalloys.com writes: t Is there a \ command to show all tables in the current search path? t Even ones that are masked by earlier search_path entries? No. Correct. Just wondering if there was something undocumented :) t You

Re: [GENERAL] Postgres auditing features

2009-06-11 Thread Greg Smith
On Thu, 11 Jun 2009, SHARMILA JOTHIRAJAH wrote: Does postgresql have any build-in auditing features like in Oracle's total-recall or fine grained auditing There's nothing built-in, but it's not too difficult to build such facilities yourself. I'm quite sure you could find someone who would

Re: [GENERAL] help with data recovery from injected UPDATE

2009-06-11 Thread Scott Marlowe
On Thu, Jun 11, 2009 at 1:32 PM, Chris Spottsrfu...@gmail.com wrote: It's a classic story.  I'm volunteering about one day per month for this project, learning SQL as I go.  Priority was always given to the get it working tasks and never the make it safe tasks.  I had/have grandiose plans to

Re: [GENERAL] search for partial dates

2009-06-11 Thread Andy Colson
James B. Byrne wrote: Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised query can handle all three circumstances? That's a little vague, so how about: select * from

Re: [GENERAL] Postgres auditing features

2009-06-11 Thread Alvaro Herrera
Greg Smith wrote: On Thu, 11 Jun 2009, SHARMILA JOTHIRAJAH wrote: Does postgresql have any build-in auditing features like in Oracle's total-recall or fine grained auditing There's nothing built-in, but it's not too difficult to build such facilities yourself. I have added this to the

Re: [GENERAL] listing relations

2009-06-11 Thread Greg Smith
On Thu, 11 Jun 2009, Brandon Metcalf wrote: Is there a \ command to show all tables in the current search path? SELECT nspname,relname,relkind FROM pg_class c, pg_namespace n WHERE c.relnamespace = n.oid AND relkind='r' AND nspname !~ '^pg_toast' AND nspname =

Re: [GENERAL] When to use cascading deletes?

2009-06-11 Thread Leif B. Kristensen
On Thursday 11. June 2009, David wrote: When is a good time to use cascading deletes? As a real world example, I've got a data model that consists of three major entities: Persons, Events, and Sources. The Events table is linked to Persons through the junction table Participants, and to the

Re: [GENERAL] search for partial dates

2009-06-11 Thread Leif B. Kristensen
On Thursday 11. June 2009, James B. Byrne wrote: Given a datetime column, not null, is there a single syntax that permits searching for all dates in a given year, year+month, and year+month+day such that a single parameterised query can handle all three circumstances? Apart from the other

[GENERAL] Retrieving performance information on a query

2009-06-11 Thread Karl Denninger
Is there a way through the libpq interface to access performance data on a query? I don't see an obvious way to do it - that is, retrieve the amount of time (clock, cpu, etc) required to process a command or query, etc Thanks in advance! -- -- Karl Denninger k...@denninger.net