[HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
Hello I enhanced DO statement syntax to allowing a parameters. Syntax is relative simple: do ([varname] vartype := value, ...) $$ ... $$ It allows to pass a content of psql variables to inline code block to allows more easy scripting \set schema 'public' do(text := :'schema') $$ declare r

Re: [HACKERS] pessimal trivial-update performance

2010-07-04 Thread Rainer Pruy
Am 04.07.2010 06:11, wrote Tom Lane: ... but is it representative of real-world cases? regards, tom lane Hi Tom, we do run an application in productive use that suffered from a similar effect. We did not have 100 updates per row, but 10-100 updates per row on

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Florian Pflug
On Jul4, 2010, at 08:41 , Pavel Stehule wrote: I enhanced DO statement syntax to allowing a parameters. Syntax is relative simple: do ([varname] vartype := value, ...) $$ ... $$ I think it'd be more useful to put the values at the very end of the statement, not somewhere in the middle. For

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Florian Pflug f...@phlo.org: On Jul4, 2010, at 08:41 , Pavel Stehule wrote: I enhanced DO statement syntax to allowing a parameters. Syntax is relative simple: do ([varname] vartype := value, ...) $$ ... $$ I think it'd be more useful to put the values at the very end of the

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Florian Pflug
On Jul4, 2010, at 11:59 , Pavel Stehule wrote: 2010/7/4 Florian Pflug f...@phlo.org: On Jul4, 2010, at 08:41 , Pavel Stehule wrote: I enhanced DO statement syntax to allowing a parameters. Syntax is relative simple: do ([varname] vartype := value, ...) $$ ... $$ I think it'd be more

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Florian Pflug f...@phlo.org: On Jul4, 2010, at 11:59 , Pavel Stehule wrote: 2010/7/4 Florian Pflug f...@phlo.org: On Jul4, 2010, at 08:41 , Pavel Stehule wrote: I enhanced DO statement syntax to allowing a parameters. Syntax is relative simple: do ([varname] vartype := value, ...)

Re: [HACKERS] pessimal trivial-update performance

2010-07-04 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Sun, Jul 4, 2010 at 12:11 AM, Tom Lane t...@sss.pgh.pa.us wrote: I believe that none of the dead row versions can be vacuumed during this test. Yep, you seem to be right. The table grows to 802 pages. But why is it that we can't vacuum them as

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: my syntax is reflecting fact, so these are not true parameters - it's +/- similar to default values of function parameters. FWIW, that doesn't seem like a positive to me. You cannot to write do (a int := $1) $$ ... $$ - because utils statements

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Andrew Dunstan
On Sun, July 4, 2010 9:58 am, Tom Lane wrote: BTW, we intentionally didn't put any provision for parameters into DO originally. What's changed to alter that decision? Nothing that I know of, I think there is just a little impatience here. I think the consensus was that we needed to get some

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: my syntax is reflecting fact, so these are not true parameters - it's +/- similar to default values of function parameters. FWIW, that doesn't seem like a positive to me. You cannot to write do (a int :=

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Tom Lane t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com writes: my syntax is reflecting fact, so these are not true parameters - it's +/- similar to default values of function parameters. FWIW, that doesn't seem like a positive to me. You cannot to write do (a int :=

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Andrew Dunstan
Pavel Stehule wrote: BTW, we intentionally didn't put any provision for parameters into DO originally. What's changed to alter that decision? It just concept - nothing more. And my instinct speak so inline code block without external parametrization is useless. You have said

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Andrew Dunstan and...@dunslane.net: Pavel Stehule wrote: BTW, we intentionally didn't put any provision for parameters into DO originally.  What's changed to alter that decision? It just concept - nothing more. And my instinct speak so inline code block without external

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: This whole proposal strikes me as premature. What we need is some experience from the field in using DO before we can sensibly decide how it should be extended. And we won't get that until 9.0 has been released and used for a while. +1. What

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Andres Freund
On Sun, Jul 04, 2010 at 11:38:47AM -0400, Andrew Dunstan wrote: Pavel Stehule wrote: BTW, we intentionally didn't put any provision for parameters into DO originally. What's changed to alter that decision? It just concept - nothing more. And my instinct speak so inline code block

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Tom Lane t...@sss.pgh.pa.us: Andrew Dunstan and...@dunslane.net writes: This whole proposal strikes me as premature. What we need is some experience from the field in using DO before we can sensibly decide how it should be extended. And we won't get that until 9.0 has been released

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/4 Andres Freund and...@anarazel.de: On Sun, Jul 04, 2010 at 11:38:47AM -0400, Andrew Dunstan wrote: Pavel Stehule wrote: BTW, we intentionally didn't put any provision for parameters into DO originally.  What's changed to alter that decision? It just concept - nothing more. And

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Florian Pflug
On Jul4, 2010, at 13:57 , Pavel Stehule wrote: I don't really buy that argument. By using a psql variable, you simply move the quoting escaping business from SQL to the shell where psql is called. True, you avoid SQL injectiont, but in turn you make yourself vulnerable to shell injection.

[HACKERS] Always truncate segments before unlink

2010-07-04 Thread Takahiro Itagaki
I have a report from an user that postgres server gave up REINDEX commands on the almost-disk-full machine. The disk spaces were filled with old index segments, that should be replaced with re-constructed files made by the REINDEX. In mdunlink(), we truncate the first main fork to zero length and

Re: [HACKERS] proof concept: do statement parametrization

2010-07-04 Thread Pavel Stehule
2010/7/5 Florian Pflug f...@phlo.org: On Jul4, 2010, at 13:57 , Pavel Stehule wrote: I don't really buy that argument. By using a psql variable, you simply move the quoting escaping business from SQL to the shell where psql is called. True, you avoid SQL injectiont, but in turn you make

[HACKERS] Implementation of median in PostgreSQL - questions

2010-07-04 Thread Pavel Stehule
Hello I am planning to start to implement median function. I wrote some array based implementation - it is fast, but I hope, so can be much faster. The basic question is method of implementation. It can be implemented via a) custum aggregate functions or b) executor node. Adventage of @a