Re: [GENERAL] connecting using libpq breaks printf

2009-02-20 Thread Albe Laurenz
Joey Morris wrote: This is my first attempt at using libpq, and I'm running across a strange problem. Here is my bare-bones program: #include stdio.h #include libpq-fe.h int main(int argc, char **argv) { PGconn *conn; fprintf(stderr, connecting\n); conn =

Re: [GENERAL] xpath functions

2009-02-20 Thread Francisco
I have executed pg_config and I have the libxml. I think the problem is that xml2 is not enabled, any idea how to enable it? 2009/2/19 Osvaldo Kussama osvaldo.kuss...@gmail.com 2009/2/19 Francisco ricke...@gmail.com: I saw it,but it says: Use of many of these functions requires the

Re: [GENERAL] Question about functions that return a set of records

2009-02-20 Thread Albe Laurenz
Mike Christensen wrote: I have the following function: CREATE FUNCTION foo(_userid uuid) RETURNS SETOF record AS $BODY$ BEGIN RETURN QUERY select n.UserId, u.Alias, n.Date, n.Data --Bunch of joins, etc If I understand correctly, I have to return SETOF record since my

Re: [GENERAL] Question about functions that return a set of records

2009-02-20 Thread Mike Christensen
Hey thanks for your email, this was exactly the explanation I was looking for. I figured out the CREATE TYPE technique but I'm gonna give the out parameters a try as well, it kinda looks cleaner especially if the only thing that uses the type is a single stored proc.. Albe Laurenz wrote:

Re: [GENERAL] Logfile permissions

2009-02-20 Thread Jasen Betts
On 2009-02-10, Thomas Guettler h...@tbz-pariv.de wrote: Hi, my logfiles all have this permission: -rw--- 1 postgres postgres14841 10. Feb 08:52 postgresql-2009-02-10_00.log Is it possible that postgres creates group readable files? you could patch and recompile the source.

Re: [GENERAL] password for postgres

2009-02-20 Thread Jasen Betts
On 2009-02-13, Kusuma Pabba kusu...@ncoretech.com wrote: i don't know y am i getting this problem when i try to start off postgres it asks me for password: what OS. what command are you using? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] postgres wish list

2009-02-20 Thread Jasen Betts
On 2009-02-19, Sameer Mahajan sameer_maha...@symantec.com wrote: Thanks Craig. Comments inline. [Sameer Mahajan] I will investigate how the unix domain sockets help in my case. Why isn't it the default for postgres installations? Or it isn't believed to be generic enough / straight

Re: [GENERAL] Query with date where clause is very slow

2009-02-20 Thread Jasen Betts
On 2009-02-20, Mike Christensen ima...@comcast.net wrote: Hi all - I have a fairly simple query: select * from subscriptions s inner join notifications n on n.userid = s.userid inner join users u on u.userid = s.userid where s.subscriberid='affaa328-5b53-430e-991a-22674ede6faf' and n.date

Re: [GENERAL] Large object loading stalls

2009-02-20 Thread Michael Akinde
Tom Lane wrote: Hmm, can you attach to the stuck backend and the vacuum worker process with gdb and get stack traces from them? The pg_locks view does not indicate any locking problem, but I'm wondering if there could be a deadlock at the LWLock level. My reply seems to have been lost in the

[GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! The following query works well: select count (*) from item_audit where audit_ts = '2008-05-30 00:00:00' and audit_ts = '2008-10-30 00:00:00' and 'wst' != (select split_part(category, '-', 2) from description where

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! Sorry, let me revise the query a bit. I copied and pasted the original one from another big query. --- On Fri, 2/20/09, Eus e...@member.fsf.org wrote: The following query works well: select count (*) from item_audit as ia where audit_ts = '2008-05-30 00:00:00' and audit_ts =

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread A. Kretschmer
In response to Eus : Hi Ho! The following query works well: select count (*) from item_audit where audit_ts = '2008-05-30 00:00:00' and audit_ts = '2008-10-30 00:00:00' and 'wst' != (select split_part(category, '-', 2) from description

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Miguel Ángel MF
I'm no expert, but: i might say U should Escape the ` ' ´ char in (select split_part(category, '-', 2) using something like (select split_part(category, \'-\', 2) or however it should be... A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Marc Schablewski
You are using old-style function declaration where the function body is given as a string enclosed in '. You have to escape all ' inside the body by doubling them. As an alternative, you can use $$ as the begin and end markers of your function body instead of the ' then you don't need to escape.

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! --- On Fri, 2/20/09, Miguel Ángel MF michelangel...@gmail.com wrote: I'm no expert, but: i might say U should Escape the ` ' ´ char in (select split_part(category, '-', 2) using something like (select split_part(category, \'-\', 2) or however it should be... Yes, you are right!

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Ketema Harris
Use dollar quoting around your fiction body I'd double up on the single quotes around the dash Sent from my iPhone On Feb 20, 2009, at 8:14 AM, Eus e...@member.fsf.org wrote: Hi Ho! Sorry, let me revise the query a bit. I copied and pasted the original one from another big query. ---

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! --- On Fri, 2/20/09, A. Kretschmer andreas.kretsch...@schollglas.com wrote: In response to Eus : Hi Ho! The following query works well: select count (*) from item_audit where audit_ts = '2008-05-30 00:00:00' and audit_ts = '2008-10-30 00:00:00' and

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! --- On Fri, 2/20/09, Ketema Harris ket...@ketema.net wrote: Use dollar quoting around your fiction body I'd double up on the single quotes around the dash Yup, I got it. Thank you for your help. Sent from my iPhone Best regards, Eus (FSF member #4445) In this digital era, where

Re: [GENERAL] Why I cannot call a function from within an SQL function?

2009-02-20 Thread Eus
Hi Ho! --- On Fri, 2/20/09, Marc Schablewski m...@clickware.de wrote: You are using old-style function declaration where the function body is given as a string enclosed in '. You have to escape all ' inside the body by doubling them. Ah, yes, after re-reading the doc, I found: --- 8 ---

Re: [GENERAL] Question about functions that return a set of records

2009-02-20 Thread Francisco Figueiredo Jr.
On Fri, Feb 20, 2009 at 3:50 AM, Mike Christensen ima...@comcast.net wrote: I have the following function: CREATE FUNCTION foo(_userid uuid)  RETURNS SETOF record AS $BODY$ BEGIN  RETURN QUERY   select n.UserId, u.Alias, n.Date, n.Data   --Bunch of joins, etc If I understand correctly,

Re: [GENERAL] Service not starting during install

2009-02-20 Thread imageguy
Any ideas now? Are you *sure* you have checked the permissions of the os user_id that is assigned to run the postgreSQL service ? PG is very specific about the permissions it wants and just as importantly it is very specific about the permissions it DOES NOT want. I would suggest you start

Re: [GENERAL] where to divide application and database

2009-02-20 Thread David Fetter
On Thu, Feb 19, 2009 at 11:43:19PM +, Sam Mason wrote: I was just reading over a reply from David Fetter from a couple of days ago; the thread is archived[1] but this question doesn't really relate to it much. The a question about how to arrange tables and David make the following

Re: [GENERAL] Large object loading stalls

2009-02-20 Thread Tom Lane
Michael Akinde michael.aki...@met.no writes: Anyway - the situation now is that just the loading process is hanging on the server, with an IDLE in transaction. But it is definitely the loading program that is hanging, not the Postgres server. What the stack traces seem to show is that both

Re: [GENERAL] where to divide application and database

2009-02-20 Thread Ivan Sergio Borgonovo
On Fri, 20 Feb 2009 06:50:22 -0800 David Fetter da...@fetter.org wrote: The reason behind this appears to be moving some of the checks into the database and away from the application. Since a useful database has *many* applications instead of the application, I think this is an excellent

[GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Torsten Bronger
Hallöchen! Yesterday I ported a web app to PG. Every 10 minutes, a cron job scanned the log files of MySQL and generated a plot showing the queries/sec for the last 24h. (Admittedly queries/sec is not the holy grail of DB statistics.) But I still like to have something like this. At the

Re: [GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Bill Moran
In response to Torsten Bronger bron...@physik.rwth-aachen.de: Hallöchen! Yesterday I ported a web app to PG. Every 10 minutes, a cron job scanned the log files of MySQL and generated a plot showing the queries/sec for the last 24h. (Admittedly queries/sec is not the holy grail of DB

Re: [GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Joshua D. Drake
On Fri, 2009-02-20 at 17:11 +0100, Torsten Bronger wrote: Hallöchen! Yesterday I ported a web app to PG. Every 10 minutes, a cron job scanned the log files of MySQL and generated a plot showing the queries/sec for the last 24h. (Admittedly queries/sec is not the holy grail of DB

Re: [GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Scott Marlowe
On Fri, Feb 20, 2009 at 9:11 AM, Torsten Bronger bron...@physik.rwth-aachen.de wrote: Hallöchen! Yesterday I ported a web app to PG. Every 10 minutes, a cron job scanned the log files of MySQL and generated a plot showing the queries/sec for the last 24h. (Admittedly queries/sec is not the

Re: [GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Torsten Bronger
Hallöchen! Joshua D. Drake writes: On Fri, 2009-02-20 at 17:11 +0100, Torsten Bronger wrote: Yesterday I ported a web app to PG. Every 10 minutes, a cron job scanned the log files of MySQL and generated a plot showing the queries/sec for the last 24h. (Admittedly queries/sec is not the

[GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Cott Lang
We're running 8.3.5 on RHEL4 x86_64. We removed a user yesterday and were greeted with warnings from pg_dump this morning. :) pg_dump: WARNING: owner of data type pg_toast_80075 appears to be invalid The usual archives and google searches produced mainly 8.0 and earlier incidents and suggested

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Joshua D. Drake
On Fri, 2009-02-20 at 12:01 -0700, Cott Lang wrote: We're running 8.3.5 on RHEL4 x86_64. We removed a user yesterday and were greeted with warnings from pg_dump this morning. :) pg_dump: WARNING: owner of data type pg_toast_80075 appears to be invalid The usual archives and google

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Tom Lane
Cott Lang c...@internetstaff.com writes: The owner of the actual table and index is correct, only the type has an invalid owner. I have thus far avoided the temptation to try a manual update... That's probably your best bet. Since Postgres now prevents you from dropping users owning objects,

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Cott Lang
On Fri, 2009-02-20 at 11:25 -0800, Joshua D. Drake wrote: You can use alter type to change the owner of the type to a valid user but see above. Something is wrong. That's what I thought too, but we tried that first with these results: # alter type pg_toast.pg_toast_80075 OWNER TO

Re: [GENERAL] where to divide application and database

2009-02-20 Thread Sam Mason
On Fri, Feb 20, 2009 at 06:50:22AM -0800, David Fetter wrote: On Thu, Feb 19, 2009 at 11:43:19PM +, Sam Mason wrote: On Tue, Feb 17, 2009 at 09:53:00AM -0800, David Fetter wrote: user_name TEXT, -- unless length is an integrity constraint, use TEXT instead of VARCHAR. then

Re: [GENERAL] where to divide application and database

2009-02-20 Thread Sam Mason
On Fri, Feb 20, 2009 at 04:51:33PM +0100, Ivan Sergio Borgonovo wrote: What I find a bit annoying is politely deal with the error once it is reported back to the application *and* connection and *bandwidth* costs of moving clearly wrong data back and forward. This sounds a bit like premature

[GENERAL] Compatibilidad RH enterprise 5.3 !!!

2009-02-20 Thread Angelo Astorga
Tenia RH enterprise 3.0 con postgresql 7.4.3 y PHP 4.3.2, migre todo a RH enterprise 5.3 con postgresql 8.1.11 y PHP 5.1.6, migre la BD y pude montarla, pero, no tengo acceso a la BD desde apache... algun ayudita al respecto !!! aastorga

Re: [GENERAL] Getting time-dependent load statistics

2009-02-20 Thread Torsten Bronger
Hallöchen! Torsten Bronger writes: [...] Currently, I experiment with SELECT tup_returned + tup_fetched + tup_inserted + tup_updated + tup_deleted FROM pg_stat_database WHERE datname='chantal'; Stangely, the statistics coming out of it are extremely high. I just dumped my database with

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Cott Lang
Tom, Thanks for the inspiration - I've fixed them manually. I spent a few minutes trying to recreate the obvious test case, and it all works as designed. I reviewed our logs from the user removal yesterday, and the tables linked to these toast tables did not have ownership changed yesterday, so

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Tom Lane
Cott Lang c...@internetstaff.com writes: I found a handful of other pg_types with an unusual owner and in every case, the toast type is owned by the user that created the database via full pg_restore some months ago. pg_restore should have created the table as the user running it, and

Re: [GENERAL] Compatibilidad RH enterprise 5.3 !!!

2009-02-20 Thread Rodrigo E . De León Plicet
2009/2/20 Angelo Astorga angeloasto...@gmail.com: Tenia RH enterprise 3.0 con postgresql 7.4.3 y PHP 4.3.2, migre todo a RH enterprise 5.3 con postgresql 8.1.11 y PHP 5.1.6, migre la BD y pude montarla, pero, no tengo acceso a la BD desde apache... algun ayudita al respecto !!! Demasiado

Re: [GENERAL] Fixing invalid owners on pg_toast tables in 8.3.5

2009-02-20 Thread Cott Lang
On Fri, 2009-02-20 at 16:35 -0500, Tom Lane wrote: Can you see any pattern or common characteristic to the tables whose toast pg_type rows failed to change owner? I'm not sure what to look for exactly, but similarities in the column contents might be a possibility. Also, can you tell if the