Re: [GENERAL] triggers problems whit function

2008-10-23 Thread Guillaume Lelarge
Tom Lane a écrit : Guillaume Lelarge [EMAIL PROTECTED] writes: Fernando Moreno a écrit : A trigger function must have a specific structure, it takes no arguments It can take arguments. No, it can't. At least not in the declaration. Oops, you're right. Arguments shouldn't be declared,

Re: [GENERAL] triggers problems whit function

2008-10-23 Thread MOLINA BRAVO FELIPE DE JESUS
El mié, 22-10-2008 a las 15:01 -0500, Ma. Cristina Peña C. escribió: I want to use a function in to a trigger This is my CREATE FUNCTION subradio(integer) RETURNS integer AS 'select cast(count (claveubica) as integer ) from asradios where ubicacion =0;' LANGUAGE 'sql'; And

Re: [GENERAL] Shopping cart

2008-10-23 Thread Aarni
On Wednesday 22 October 2008 18:39:53 Jonathan Bond-Caron wrote: If there's no time constraints, I'd do as someone mentioned and build it yourself. Open source or even commercial e-commerce solutions tend to get very complicated in trying to be 'flexible'. i.e. CREATE TABLE shopping_carts

[GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Otandeka Simon Peter
Hi All, I am trying to import db from 8.1.3 to 8.3.1 database however I get some characters \x09\x09\x09\x09. I know this is an error in 8.3.1 that was fixed in later updates however is there a way of getting around it without going all over again and remain with 8.3.1 database where I have

[GENERAL] max time in a table query takes ages

2008-10-23 Thread Grzegorz Jaśkiewicz
hey folks I have a simple query over a fairly simple query here, that scans for max date in a table that's fairly hudge (300M rows). there's index on that field that's being used, but for whatever reason, it takes ages. Ideas ? select date_trunc('day', max(data)) into dt from staticstats where

Re: [GENERAL] max time in a table query takes ages

2008-10-23 Thread Pavel Stehule
Hello try VACUUM and REINDEX regards Pavel Stehule 2008/10/23 Grzegorz Jaśkiewicz [EMAIL PROTECTED]: hey folks I have a simple query over a fairly simple query here, that scans for max date in a table that's fairly hudge (300M rows). there's index on that field that's being used, but for

Re: [GENERAL] Shopping cart

2008-10-23 Thread Thomas Guettler
Aarni schrieb: As Jonathan said, the trick is not in getting the shop online but in the management side of it all. The public shop interface is in fact only a small proportion of the system. Hi, I know the OP wants to stick to a language he knows, but with django (Python), you have a

[GENERAL] Explain's estimation differs from real count enormously

2008-10-23 Thread Sergey Konoplev
Hi, My environment is: PostgreSQL 8.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) + recent patch from Teodor Sigaev EXPLAIN ANALYZE of the query shows strange estimated rows count: EXPLAIN ANALYZE SELECT * FROM objonmap WHERE 1=1 AND box(om_point,

Re: [GENERAL] Shopping cart

2008-10-23 Thread Andrus
Thank you. I know the OP wants to stick to a language he knows, but with django (Python), you have a quite good admin site. I guess the OP would be more fast with django, even if he needs to learn python on his way. Major stopper for python usage is lack of hosting. Where to find free

Re: [GENERAL] max time in a table query takes ages

2008-10-23 Thread Grzegorz Jaśkiewicz
if reindex will help (which I will run overnight, and will let you know Tomorrow) - I find it quite worrying, cos it is 8.3, and I was hoping - with HOT in place, and all these features - that reindexing of that table wouldn't be needed. it is 'only' 375M rows now, but I can definetively feel pain

Re: [GENERAL] Explain's estimation differs from real count enormously

2008-10-23 Thread Grzegorz Jaśkiewicz
run vacuum analyze table; before running that query, is it still off after that ?

Re: [GENERAL] Explain's estimation differs from real count enormously

2008-10-23 Thread Sergey Konoplev
run vacuum analyze table; before running that query, is it still off after that ? I forgot to mention that ANALYZE, VACUUM ANALYZE even w/ FULL and REINDEX doesn't help. -- Regards, Sergey Konoplev -- PostgreSQL articles in english russian

Re: [GENERAL] Database design for separate tsearch table

2008-10-23 Thread Mikkel H??gh
On Thu, Oct 23, 2008 at 01:06:26AM +0200, Ivan Sergio Borgonovo wrote: weight them and you'll be able to search by field and globally. I didn't make any scientific test but I previously had something like: create table subtable ( subtableid int, body text, ftidx tsvector ) create table

Re: [GENERAL] Explain's estimation differs from real count enormously

2008-10-23 Thread Sergey Konoplev
EXPLAIN ANALYZE of the query shows strange estimated rows count: EXPLAIN ANALYZE SELECT * FROM objonmap WHERE 1=1 AND box(om_point, om_point) @ box(point(-55.97398205077, -100), point(82.166446008477, 180)) AND (om_flag OR om_ref_id IN (6901071, 6901513, 6901092,

Re: [GENERAL] Shopping cart

2008-10-23 Thread Thomas Guettler
Andrus schrieb: Thank you. I know the OP wants to stick to a language he knows, but with django (Python), you have a quite good admin site. I guess the OP would be more fast with django, even if he needs to learn python on his way. Major stopper for python usage is lack of hosting.

Re: [GENERAL] Database design for separate tsearch table

2008-10-23 Thread Ivan Sergio Borgonovo
On Thu, 23 Oct 2008 14:20:49 +0200 Mikkel Høgh [EMAIL PROTECTED] wrote: but it seem that just searching on a tsvector in maintable build up with setweight(to_tsvector('pg_catalog.english', coalesce(maintable.body,'')), 'A') || ' ' || setweight(to_tsvector('pg_catalog.english',

Re: [GENERAL] Explain's estimation differs from real count enormously

2008-10-23 Thread Tom Lane
Sergey Konoplev [EMAIL PROTECTED] writes: Could somebody explain me why it happens and how to make it work right? Implement a selectivity estimator for @ that isn't just a stub :-( regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Andrew Sullivan
On Thu, Oct 23, 2008 at 12:58:39PM +0300, Otandeka Simon Peter wrote: Hi All, I am trying to import db from 8.1.3 to 8.3.1 database however I get some characters \x09\x09\x09\x09. I know this is an error in 8.3.1 that was fixed in later updates however is there a way of getting around it

Re: [GENERAL] max time in a table query takes ages

2008-10-23 Thread Tom Lane
=?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= [EMAIL PROTECTED] writes: I have a simple query over a fairly simple query here, that scans for max date in a table that's fairly hudge (300M rows). there's index on that field that's being used, but for whatever reason, it takes ages. Ideas ? select

Re: [GENERAL] max time in a table query takes ages

2008-10-23 Thread Grzegorz Jaśkiewicz
On Thu, Oct 23, 2008 at 2:47 PM, Tom Lane [EMAIL PROTECTED] wrote: I suppose the problem is that rows with processed = false are very few in the upper range of data. If so, and if you really need this to go fast, a partial index might be worth its overhead: create index foo on

[GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Jack Orenstein
I'm using postgres 7.4 and having a problem with the query optimizer. Our table, T, looks like this: dh int fh int nm int ... -- other columns A typical row is 400-500 bytes. T has two indexes, idx_df on (dh, fh) and idx_dn on (dh, nm). My query is

[GENERAL] overhead of plpgsql functions over simple select

2008-10-23 Thread Ivan Sergio Borgonovo
I'd like to encapsulate something that now is just a simple select in a plpgsql function now just to keep an interface consistent but even for well... encapsulating the sql. Right now a simple select statement will suffice. What kind of overhead a plpgsql that just return a select incur compared

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Tom Lane
Jack Orenstein [EMAIL PROTECTED] writes: If I run EXPLAIN on this query, (plugging in values 1 and 2 for the variables), before VACUUM ANALYZE, I get the desired execution plan: Index Scan using idx_df on T (cost=0.00..4.83 rows=1 width=454) Index Cond: ((dh = 1) AND (fh = 2)) But

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Bruce Momjian
Greg Smith wrote: On Fri, 17 Oct 2008, Bill Moran wrote: You can resent it or not, but this _is_ a personal thing. It's personal because you are the only one complaining about it. Despite the large number of people on this list, I don't see anyone jumping in to defend you. Mikkel

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Jack Orenstein
Tom Lane wrote: Jack Orenstein [EMAIL PROTECTED] writes: If I run EXPLAIN on this query, (plugging in values 1 and 2 for the variables), before VACUUM ANALYZE, I get the desired execution plan: Index Scan using idx_df on T (cost=0.00..4.83 rows=1 width=454) Index Cond: ((dh = 1) AND

Re: [GENERAL] [HACKERS] Hot Standby utility and administrator functions

2008-10-23 Thread Simon Riggs
On Mon, 2008-10-20 at 10:25 +0100, Simon Riggs wrote: What else do we need? * pg_freeze_recovery() * pg_unfreeze_recovery() Two more functions pg_freeze_recovery_cleanup() pg_unfreeze_recovery_cleanup() These would allow recovery to continue normally, except for row removal operations

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Tom Lane
Jack Orenstein [EMAIL PROTECTED] writes: Tom Lane wrote: If you plug in a value that *does* occur in the table it should probably choose the more-relevant index consistently. Unfortunately, it matters a lot at runtime. The dh value is not very selective, as shown by the statistics above.

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Jack Orenstein
Researching this some more, it appears to be the case that VACUUM (by itself, no ANALYZE) is changing the optimizer's behavior. Here is a self-contained test: select '*** drop t'; drop table t cascade; select '*** create t(dh, fh, nm, filler)'; create table t (dh int, fh int, nm int, filler

[GENERAL] Tips on how to efficiently debugging PL/PGSQL

2008-10-23 Thread cyw
Just to seek some tips on how to efficiently debug PL/SQL. One thing that bugs me in particular is the inability to trace a SQL line number in an error message to the line in my PL/PGSQL code. Thanks, CYW -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Otandeka Simon Peter
Upgraded to 8.3.4 but am still getting the same error Anything I can do about it? On Thu, Oct 23, 2008 at 4:35 PM, Andrew Sullivan [EMAIL PROTECTED] wrote: On Thu, Oct 23, 2008 at 12:58:39PM +0300, Otandeka Simon Peter wrote: Hi All, I am trying to import db from 8.1.3 to 8.3.1 database

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Collin Kidder
Bruce Momjian wrote: Mikkel is right, every other well-organized mailing list I've ever been on handles things the sensible way he suggests, but everybody on his side who's been on lists here for a while already knows this issue is a dead horse. Since I use the most advanced e-mail client

Re: [GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Andrew Sullivan
On Thu, Oct 23, 2008 at 08:24:12PM +0300, Otandeka Simon Peter wrote: Upgraded to 8.3.4 but am still getting the same error So it isn't an error in 8.3.1. But my bet is this: On Thu, Oct 23, 2008 at 4:35 PM, Andrew Sullivan [EMAIL PROTECTED] wrote I am trying to import db from 8.1.3 to

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Jack Orenstein
Tom Lane wrote: Jack Orenstein [EMAIL PROTECTED] writes: Tom Lane wrote: If you plug in a value that *does* occur in the table it should probably choose the more-relevant index consistently. Unfortunately, it matters a lot at runtime. The dh value is not very selective, as shown by the

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread ries van Twisk
On Oct 23, 2008, at 12:25 PM, Collin Kidder wrote: Bruce Momjian wrote: Mikkel is right, every other well-organized mailing list I've ever been on handles things the sensible way he suggests, but everybody on his side who's been on lists here for a while already knows this issue is a

Re: [GENERAL] Tips on how to efficiently debugging PL/PGSQL

2008-10-23 Thread Glyn Astill
From: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: [GENERAL] Tips on how to efficiently debugging PL/PGSQL To: pgsql-general@postgresql.org Date: Thursday, 23 October, 2008, 6:19 PM Just to seek some tips on how to efficiently debug PL/SQL. One thing that bugs me in particular is the

Re: [GENERAL] Postgres optimizer choosing wrong index

2008-10-23 Thread Tom Lane
Jack Orenstein [EMAIL PROTECTED] writes: I may have simplified too far. Our application runs a number of different queries. All our WHERE clauses restrict dh and fh. For a given pair of (dh, fh) values, the initial query should come up empty and then insert this pair, and then there is further

Re: [GENERAL] Storing questionnaire data

2008-10-23 Thread Sam Mason
On Wed, Oct 22, 2008 at 03:59:07PM +0100, Thom Brown wrote: I have previously had a questionnaire which had 5 tables, questions and answers and question types, questionnaire and results. This design looks a lot like the EAV (entity-attribute-value) style of database design. This tends to be

Re: [GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Andrew Sullivan wrote: I expect that your problem is that 8.1 allowed some characters in that you didn't want. You probably need to use iconv to change those characters to whatever are actually valid. \x09 is a tab. I think this behavior was changed

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Alan Hodgson
On Thursday 23 October 2008, Collin Kidder [EMAIL PROTECTED] wrote: You must use Reply All. You might say that that makes Thunderbird crippled but I see it more as a sign that nobody outside of a few fussy RFC worshipping types would ever want the behavior of the Postgre list. Yes, I'll have

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Angel Alvarez
El Jueves 23 Octubre 2008 Collin Kidder escribió: horse.  Since I use the most advanced e-mail client on the market I just work around that the settings here are weird, it does annoy me a bit anytime I stop to think about it though. What's such most advanced mail reader?? No one, ive

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Raymond O'Donnell
On 23/10/2008 19:09, Angel Alvarez wrote: No one, ive seen, seems to be perfect nor thunderbird. By the way kmail has 4 options (reply, reply to all, reply to author, reply to list) in addition to be able to use list headers included in the message. Here's a reply to list add-on for

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Collin Kidder
Angel Alvarez wrote: What's such most advanced mail reader?? No one, ive seen, seems to be perfect nor thunderbird. By the way kmail has 4 options (reply, reply to all, reply to author, reply to list) in addition to be able to use list headers included in the message. in fact many other

Re: [GENERAL] Chart of Accounts

2008-10-23 Thread James Hitz
Sorry for the silence. Have been away on official duty. Please see inline: --- On Mon, 13/10/08, justin [EMAIL PROTECTED] wrote: SNIP Create Table general_ledger_transactions( transaction_id serial not null coad_id integer, accounting_period integer, debit

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Angel Alvarez
Well but the RFC's were in fact prior to thunderbird So for he most of its life, when few people was using it, Thiunderbird was a sad example of your botched attempt of creating a standar of NOT FOLLOWING THE RFC's... Well, also M$ thought they invented internet so its a common mistake. May be

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Collin Kidder
Angel Alvarez wrote: Well but the RFC's were in fact prior to thunderbird So for he most of its life, when few people was using it, Thiunderbird was a sad example of your botched attempt of creating a standar of NOT FOLLOWING THE RFC's... But, as I mentioned, nobody cares about this

On standards weenies (was: [GENERAL] Annoying Reply-To)

2008-10-23 Thread Andrew Sullivan
On Thu, Oct 23, 2008 at 01:25:47PM -0400, Collin Kidder wrote: that that makes Thunderbird crippled but I see it more as a sign that nobody outside of a few fussy RFC worshipping types would ever want the behavior of the Postgre list. Indeed. And PostgreSQL not interpreting '' as NULL, or

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Steve Atkins
On Oct 23, 2008, at 12:01 PM, Collin Kidder wrote: Angel Alvarez wrote: Well but the RFC's were in fact prior to thunderbird So for he most of its life, when few people was using it, Thiunderbird was a sad example of your botched attempt of creating a standar of NOT FOLLOWING THE RFC's...

Re: [GENERAL] Tips on how to efficiently debugging PL/PGSQL

2008-10-23 Thread Rainer Bauer
Glyn Astill wrote: From: [EMAIL PROTECTED] [EMAIL PROTECTED] Just to seek some tips on how to efficiently debug PL/SQL. edb have a debugger that intigrates with pgadmin http://pgfoundry.org/projects/edb-debugger/ This debugger is integrated with pgAdminIII that is shipped with PostgreSQL

[GENERAL] Uninstalling the debugger?

2008-10-23 Thread Raymond O'Donnell
Hi all, How do you uninstall the pl/pgsql debugger? Looking in the contrib directory, I see the file pldbgapi.sql for installing it, but no corresponding uninstall_.. file as all the other contrib modules seem to have. I could (and have) just delete the functions and types one by one, but surely

Re: [GENERAL] Storing questionnaire data

2008-10-23 Thread Thom Brown
Hi Sam, thanks for your suggestion. I'm afraid such a rigid structure is completely tailored for a specific questionnaire. What if I, or even a client, wanted to generate different questionnaires? I would like the data to indicate the flow of questions and answers rather than just use the

Re: [GENERAL] Import db from 8.1.3 to 8.3.1

2008-10-23 Thread Alvaro Herrera
Andrew Sullivan wrote: On Thu, Oct 23, 2008 at 08:24:12PM +0300, Otandeka Simon Peter wrote: Upgraded to 8.3.4 but am still getting the same error So it isn't an error in 8.3.1. But my bet is this: On Thu, Oct 23, 2008 at 4:35 PM, Andrew Sullivan [EMAIL PROTECTED] wrote I am

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Greg Smith
On Thu, 23 Oct 2008, Angel Alvarez wrote: horse.  Since I use the most advanced e-mail client on the market I just work around that the settings here are weird What's such most advanced mail reader?? That quoted bit was actually from me, I was hoping to get a laugh out of anyone who

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Alvaro Herrera
Greg Smith escribió: On Thu, 23 Oct 2008, Angel Alvarez wrote: horse.  Since I use the most advanced e-mail client on the market I just work around that the settings here are weird What's such most advanced mail reader?? That quoted bit was actually from me, I was hoping to get a laugh out

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread ries van Twisk
On Oct 23, 2008, at 3:44 PM, Greg Smith wrote: On Thu, 23 Oct 2008, Angel Alvarez wrote: horse. Since I use the most advanced e-mail client on the market I just work around that the settings here are weird What's such most advanced mail reader?? That quoted bit was actually from me, I

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Dave Coventry
2008/10/23 Steve Atkins [EMAIL PROTECTED]: If you don't like it (and this applies to everyone else arguing about it, on either side) please do one of these three things: 1. Fix it locally at your end, as is trivial to do with procmail, amongst other approaches, and quit whining about it. or

Re: [GENERAL] Storing questionnaire data

2008-10-23 Thread David Fetter
On Wed, Oct 22, 2008 at 03:59:07PM +0100, Thom Brown wrote: Hi, Is there any optimal and generally agreed way to store questionnaire data in a database? The questionnaire would have to support both of the following: Without going EAV (almost always a mistake, this should get you a long

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Aarni
Hulou hjuvat folkenbergers und goody good peoples ute po daer in allas e oceanos / terranos, I chose to 'Reply to Mailing-List' in my preferred mail app. (Kmail on Ubuntu 8.10) I really don't know why ... but shore hope, mean sure, as in truly, this is hopefully not an annoying postage

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Rob Wultsch
On Thu, Oct 23, 2008 at 10:42 AM, ries van Twisk [EMAIL PROTECTED] wrote: On Oct 23, 2008, at 12:25 PM, Collin Kidder wrote: Bruce Momjian wrote: Mikkel is right, every other well-organized mailing list I've ever been on handles things the sensible way he suggests, but everybody on his

Re: [GENERAL] Annoying Reply-To

2008-10-23 Thread Guy Rouillier
Raymond O'Donnell wrote: On 23/10/2008 19:09, Angel Alvarez wrote: No one, ive seen, seems to be perfect nor thunderbird. By the way kmail has 4 options (reply, reply to all, reply to author, reply to list) in addition to be able to use list headers included in the message. Here's a reply

Re: [GENERAL] Storing questionnaire data

2008-10-23 Thread Jeff Davis
On Thu, 2008-10-23 at 21:38 +0100, Thom Brown wrote: I'm afraid such a rigid structure is completely tailored for a specific questionnaire. What if I, or even a client, wanted to generate different questionnaires? I would like the data to indicate the flow of questions and answers rather

Re: [GENERAL] overhead of plpgsql functions over simple select

2008-10-23 Thread Pavel Stehule
Hello postgres=# create function simplefce(a int, b int) returns int as $$select $1 + $2$$ language sql immutable strict; CREATE FUNCTION postgres=# create function simplefce1(a int, b int) returns int as $$begin return a+b; end;$$ language plpgsql immutable strict; CREATE FUNCTION postgres=#

Re: [GENERAL] overhead of plpgsql functions over simple select

2008-10-23 Thread Tom Lane
Pavel Stehule [EMAIL PROTECTED] writes: postgres=# create function simplefce(a int, b int) returns int as $$select $1 + $2$$ language sql immutable strict; CREATE FUNCTION postgres=# create function simplefce1(a int, b int) returns int as $$begin return a+b; end;$$ language plpgsql immutable

Re: [GENERAL] overhead of plpgsql functions over simple select

2008-10-23 Thread Pavel Stehule
2008/10/24 Tom Lane [EMAIL PROTECTED]: Pavel Stehule [EMAIL PROTECTED] writes: postgres=# create function simplefce(a int, b int) returns int as $$select $1 + $2$$ language sql immutable strict; CREATE FUNCTION postgres=# create function simplefce1(a int, b int) returns int as $$begin return