Re: [HACKERS] plpgsql, return can contains any expression

Lists: pgsql-hackerspgsql-patches
From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: neilc(at)samurai(dot)com
Subject: plpgsql, return can contains any expression
Date: 2006-08-28 05:04:27
Message-ID: BAY20-F3D517391185B7B8CEBE4EF9380@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Hello

This patch allows using any row expression in return statement and does
transformation from untyped row to composite types if it's necessary.

Regards
Pavel Stehule

_________________________________________________________________
Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/

Attachment Content-Type Size
return.diff text/x-patch 18.0 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: plpgsql, return can contains any expression
Date: 2006-09-03 03:39:33
Message-ID: 200609030339.k833dXf08656@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


While this patch has new regression tests, it doesn't have new expected
output for it. Please update the patch to supply that. Thanks.

---------------------------------------------------------------------------

Pavel Stehule wrote:
> Hello
>
> This patch allows using any row expression in return statement and does
> transformation from untyped row to composite types if it's necessary.
>
> Regards
> Pavel Stehule
>
> _________________________________________________________________
> Chcete sdilet sve obrazky a hudbu s prateli? http://messenger.msn.cz/

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: plpgsql, return can contains any expression
Date: 2006-09-04 22:11:16
Message-ID: 13599.1157407876@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> This patch allows using any row expression in return statement and does
> transformation from untyped row to composite types if it's necessary.

This patch doesn't seem to cope with cases where the supplied tuple has
the wrong number of columns, and it doesn't look like it's being careful
about dropped columns either. Also, that's a mighty bizarre-looking
choice of cache memory context in coerce_to_tuple ... but then again,
why are you bothering with a cache at all for temporary arrays?

regards, tom lane


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: plpgsql, return can contains any expression
Date: 2006-09-15 07:31:17
Message-ID: BAY114-F15F05EBE3B03FFDD5A8A37F92E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

>
>"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> > This patch allows using any row expression in return statement and does
> > transformation from untyped row to composite types if it's necessary.
>
>This patch doesn't seem to cope with cases where the supplied tuple has
>the wrong number of columns, and it doesn't look like it's being careful
>about dropped columns either. Also, that's a mighty bizarre-looking
>choice of cache memory context in coerce_to_tuple ... but then again,
>why are you bothering with a cache at all for temporary arrays?

I am sorry, Tom. But I don't understand. I can check number of columns,
ofcourse and I'll do it. What cache for temporary arrays do you mean?

Best regards
Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2006-09-15 14:56:58
Message-ID: 24714.1158332218@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
>> This patch doesn't seem to cope with cases where the supplied tuple has
>> the wrong number of columns, and it doesn't look like it's being careful
>> about dropped columns either. Also, that's a mighty bizarre-looking
>> choice of cache memory context in coerce_to_tuple ... but then again,
>> why are you bothering with a cache at all for temporary arrays?

> I am sorry, Tom. But I don't understand. I can check number of columns,
> ofcourse and I'll do it. What cache for temporary arrays do you mean?

I thought that making coerce_to_tuple depend on estate->err_func was
pretty bizarre, and that there was no need for any "cache" at all for
arrays that need only live as long as the function runs. All you are
saving here is a palloc/pfree cycle, which is not worth the obscurantism
and risk of bugs (are you sure natts can never change?).

BTW, if you want this patch to make it into 8.2, it needs to be fixed
and resubmitted *very* soon.

regards, tom lane


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2006-09-15 21:17:48
Message-ID: BAY114-F21BB578F2FA3B0B772FFA2F92E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

>
>"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> >> This patch doesn't seem to cope with cases where the supplied tuple has
> >> the wrong number of columns, and it doesn't look like it's being
>careful
> >> about dropped columns either. Also, that's a mighty bizarre-looking
> >> choice of cache memory context in coerce_to_tuple ... but then again,
> >> why are you bothering with a cache at all for temporary arrays?
>
> > I am sorry, Tom. But I don't understand. I can check number of columns,
> > ofcourse and I'll do it. What cache for temporary arrays do you mean?
>
>I thought that making coerce_to_tuple depend on estate->err_func was
>pretty bizarre, and that there was no need for any "cache" at all for
>arrays that need only live as long as the function runs. All you are
>saving here is a palloc/pfree cycle, which is not worth the obscurantism
>and risk of bugs (are you sure natts can never change?).

No, cache there is ugly. But I don't have idea about more efective
implementation of it :-(. First version of this patch was more clean. and
little bit slow. This cache save 10%.

>
>BTW, if you want this patch to make it into 8.2, it needs to be fixed
>and resubmitted *very* soon.

I understand, but I am not able work on it in next four days. And I need
help with it from Neil. It will be for 8.3.

Thank you
Pavel

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any
Date: 2006-09-16 21:53:00
Message-ID: 200609162153.k8GLr0X07116@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


This has been saved for the 8.3 release:

http://momjian.postgresql.org/cgi-bin/pgpatches_hold

---------------------------------------------------------------------------

Pavel Stehule wrote:
>
>
> >
> >"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> > >> This patch doesn't seem to cope with cases where the supplied tuple has
> > >> the wrong number of columns, and it doesn't look like it's being
> >careful
> > >> about dropped columns either. Also, that's a mighty bizarre-looking
> > >> choice of cache memory context in coerce_to_tuple ... but then again,
> > >> why are you bothering with a cache at all for temporary arrays?
> >
> > > I am sorry, Tom. But I don't understand. I can check number of columns,
> > > ofcourse and I'll do it. What cache for temporary arrays do you mean?
> >
> >I thought that making coerce_to_tuple depend on estate->err_func was
> >pretty bizarre, and that there was no need for any "cache" at all for
> >arrays that need only live as long as the function runs. All you are
> >saving here is a palloc/pfree cycle, which is not worth the obscurantism
> >and risk of bugs (are you sure natts can never change?).
>
> No, cache there is ugly. But I don't have idea about more efective
> implementation of it :-(. First version of this patch was more clean. and
> little bit slow. This cache save 10%.
>
> >
> >BTW, if you want this patch to make it into 8.2, it needs to be fixed
> >and resubmitted *very* soon.
>
> I understand, but I am not able work on it in next four days. And I need
> help with it from Neil. It will be for 8.3.
>
> Thank you
> Pavel
>
> _________________________________________________________________
> Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
> http://messenger.msn.cz/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2007-02-08 23:25:06
Message-ID: 200702082325.l18NP6F11616@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


OK, where are we on this patch?

---------------------------------------------------------------------------

Pavel Stehule wrote:
>
>
> >
> >"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> > >> This patch doesn't seem to cope with cases where the supplied tuple has
> > >> the wrong number of columns, and it doesn't look like it's being
> >careful
> > >> about dropped columns either. Also, that's a mighty bizarre-looking
> > >> choice of cache memory context in coerce_to_tuple ... but then again,
> > >> why are you bothering with a cache at all for temporary arrays?
> >
> > > I am sorry, Tom. But I don't understand. I can check number of columns,
> > > ofcourse and I'll do it. What cache for temporary arrays do you mean?
> >
> >I thought that making coerce_to_tuple depend on estate->err_func was
> >pretty bizarre, and that there was no need for any "cache" at all for
> >arrays that need only live as long as the function runs. All you are
> >saving here is a palloc/pfree cycle, which is not worth the obscurantism
> >and risk of bugs (are you sure natts can never change?).
>
> No, cache there is ugly. But I don't have idea about more efective
> implementation of it :-(. First version of this patch was more clean. and
> little bit slow. This cache save 10%.
>
> >
> >BTW, if you want this patch to make it into 8.2, it needs to be fixed
> >and resubmitted *very* soon.
>
> I understand, but I am not able work on it in next four days. And I need
> help with it from Neil. It will be for 8.3.
>
> Thank you
> Pavel
>
> _________________________________________________________________
> Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
> http://messenger.msn.cz/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: bruce(at)momjian(dot)us
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2007-02-09 05:18:51
Message-ID: BAY114-F38C6E97F724F0686ACC43DF99C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


>
>OK, where are we on this patch?

without changes. This task have to do anybody who better know PostgreSQL
cache system than me.

Regards
Pavel
>
>---------------------------------------------------------------------------
>
>Pavel Stehule wrote:
> >
> >
> > >
> > >"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> > > >> This patch doesn't seem to cope with cases where the supplied tuple
>has
> > > >> the wrong number of columns, and it doesn't look like it's being
> > >careful
> > > >> about dropped columns either. Also, that's a mighty
>bizarre-looking
> > > >> choice of cache memory context in coerce_to_tuple ... but then
>again,
> > > >> why are you bothering with a cache at all for temporary arrays?
> > >
> > > > I am sorry, Tom. But I don't understand. I can check number of
>columns,
> > > > ofcourse and I'll do it. What cache for temporary arrays do you
>mean?
> > >
> > >I thought that making coerce_to_tuple depend on estate->err_func was
> > >pretty bizarre, and that there was no need for any "cache" at all for
> > >arrays that need only live as long as the function runs. All you are
> > >saving here is a palloc/pfree cycle, which is not worth the
>obscurantism
> > >and risk of bugs (are you sure natts can never change?).
> >
> > No, cache there is ugly. But I don't have idea about more efective
> > implementation of it :-(. First version of this patch was more clean.
>and
> > little bit slow. This cache save 10%.
> >
> > >
> > >BTW, if you want this patch to make it into 8.2, it needs to be fixed
> > >and resubmitted *very* soon.
> >
> > I understand, but I am not able work on it in next four days. And I need
> > help with it from Neil. It will be for 8.3.
> >
> > Thank you
> > Pavel
> >
> > _________________________________________________________________
> > Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
> > http://messenger.msn.cz/
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
>
>--
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://www.enterprisedb.com
>
> + If your life is a hard drive, Christ can be your backup. +
>
>---------------------------(end of broadcast)---------------------------
>TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate

_________________________________________________________________
Najdete si svou lasku a nove pratele na Match.com. http://www.msn.cz/


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: bruce(at)momjian(dot)us, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2007-02-09 15:01:17
Message-ID: 20070209150117.GD4253@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Pavel Stehule wrote:

> >OK, where are we on this patch?
>
> without changes. This task have to do anybody who better know PostgreSQL
> cache system than me.

How about you submit a version without any caching, but which works
correctly; and we worry about optimizations later?

> >---------------------------------------------------------------------------
> >
> >Pavel Stehule wrote:
> >>
> >>
> >> >
> >> >"Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com> writes:
> >> > >> This patch doesn't seem to cope with cases where the supplied tuple
> >has
> >> > >> the wrong number of columns, and it doesn't look like it's being
> >> >careful
> >> > >> about dropped columns either. Also, that's a mighty
> >bizarre-looking
> >> > >> choice of cache memory context in coerce_to_tuple ... but then
> >again,
> >> > >> why are you bothering with a cache at all for temporary arrays?
> >> >
> >> > > I am sorry, Tom. But I don't understand. I can check number of
> >columns,
> >> > > ofcourse and I'll do it. What cache for temporary arrays do you
> >mean?
> >> >
> >> >I thought that making coerce_to_tuple depend on estate->err_func was
> >> >pretty bizarre, and that there was no need for any "cache" at all for
> >> >arrays that need only live as long as the function runs. All you are
> >> >saving here is a palloc/pfree cycle, which is not worth the
> >obscurantism
> >> >and risk of bugs (are you sure natts can never change?).
> >>
> >> No, cache there is ugly. But I don't have idea about more efective
> >> implementation of it :-(. First version of this patch was more clean.
> >and
> >> little bit slow. This cache save 10%.
> >>
> >> >
> >> >BTW, if you want this patch to make it into 8.2, it needs to be fixed
> >> >and resubmitted *very* soon.
> >>
> >> I understand, but I am not able work on it in next four days. And I need
> >> help with it from Neil. It will be for 8.3.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: alvherre(at)commandprompt(dot)com
Cc: bruce(at)momjian(dot)us, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org, neilc(at)samurai(dot)com
Subject: Re: [HACKERS] plpgsql, return can contains any expression
Date: 2007-02-09 17:02:29
Message-ID: BAY114-F293F481AA6C8360F2F9BEAF99C0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

>Pavel Stehule wrote:
>
> > >OK, where are we on this patch?
> >
> > without changes. This task have to do anybody who better know PostgreSQL
> > cache system than me.
>
>How about you submit a version without any caching, but which works
>correctly; and we worry about optimizations later?
>

I can update and send simple version.

Regards
Pavel Stehule

_________________________________________________________________
Najdete si svou lasku a nove pratele na Match.com. http://www.msn.cz/