From andrew@dunslane.net Thu Oct 28 15:24:50 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 3F4701337B43 for ; Thu, 28 Oct 2010 12:25:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 19965-01 for ; Thu, 28 Oct 2010 15:24:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by mail.postgresql.org (Postfix) with ESMTP id B9A541336DB6 for ; Thu, 28 Oct 2010 12:24:54 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=3jtQBdTzPyV+fq4oCU/u8ZPrJJGN11HvhaDVxyWhycI= c=1 sm=0 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=fsnGr4-BwID0zViNlZYA:9 a=xFchFN0sp_K8kXPeUQtfYCFBwI4A:4 a=wPNLvfGTeEIA:10 a=2KQehPIfTyBWa4jaMEwA:9 a=k3mbO2Bd0jf-BfRMsVU93IgiFy8A:4 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:37209] helo=[192.168.10.104]) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id BE/C0-02631-3C599CC4; Thu, 28 Oct 2010 15:24:51 +0000 Message-ID: <4CC995C2.3000704@dunslane.net> Date: Thu, 28 Oct 2010 11:24:50 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: PostgreSQL-development CC: Tim Bunce Subject: plperl arginfo Content-Type: multipart/alternative; boundary="------------090704040409090503010005" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1982 X-Sequence-Number: 173022 This is a multi-part message in MIME format. --------------090704040409090503010005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit While we were discussing allowing generic record type arguments to plperl functions, Tom suggested that we should expose the type information about the record members to plperl. I think if we do that we should probably expand it somewhat to all arguments, so that for non-trigger functions, we'd have $_ARG_INFO while could look something like this: { names => ['arg1', undef, 'arg3' ] , # no name was supplied for arg2 modes => ['in', 'in', 'in' ], # do we support anything other than IN ? types => ['integer', 'text', { name => 'somecomposite', fields => [ 'field1', 'field2' ], types => ['date', 'numeric' ] } ], } Maybe we should also pass in type Oid info, too. I don't think this would be terribly difficult to do. thoughts? cheers andrew --------------090704040409090503010005 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit While we were discussing allowing generic record type arguments to plperl functions, Tom suggested that we should expose the type information about the record members to plperl. I think if we do that we should probably expand it somewhat to all arguments, so that for non-trigger functions, we'd have $_ARG_INFO while could look something like this:

{
    names => ['arg1', undef, 'arg3' ] , # no name was supplied for arg2
    modes => ['in', 'in', 'in' ], # do we support anything other than IN ?
    types => ['integer', 'text', { name => 'somecomposite', fields => [ 'field1', 'field2' ], types => ['date', 'numeric' ] } ],
}
Maybe we should also pass in type Oid info, too.

I don't think this would be terribly difficult to do.

thoughts?

cheers

andrew



       
--------------090704040409090503010005-- From tgl@sss.pgh.pa.us Thu Oct 28 15:39:11 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 93A571337B68 for ; Thu, 28 Oct 2010 12:39:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 19737-03-2 for ; Thu, 28 Oct 2010 15:39:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 1B85C1337B55 for ; Thu, 28 Oct 2010 12:39:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9SFdBju016687; Thu, 28 Oct 2010 11:39:11 -0400 (EDT) To: Andrew Dunstan cc: PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo In-reply-to: <4CC995C2.3000704@dunslane.net> References: <4CC995C2.3000704@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Thu, 28 Oct 2010 11:24:50 -0400" Date: Thu, 28 Oct 2010 11:39:11 -0400 Message-ID: <16686.1288280351@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/1983 X-Sequence-Number: 173023 Andrew Dunstan writes: > While we were discussing allowing generic record type arguments to > plperl functions, Tom suggested that we should expose the type > information about the record members to plperl. I think if we do that we > should probably expand it somewhat to all arguments, so that for > non-trigger functions, we'd have $_ARG_INFO while could look something > like this: > { > names => ['arg1', undef, 'arg3' ] , # no name was supplied for arg2 > modes => ['in', 'in', 'in' ], # do we support anything other > than IN ? > types => ['integer', 'text', { name => 'somecomposite', fields > => [ 'field1', 'field2' ], types => ['date', 'numeric' ] } ], > } Hmm, I'm a bit worried about the performance implications of adding this information. It seems like the value in typical cases would be minimal: when you are writing the body of "myfunction(foo int, bar text)", it's not like you don't know perfectly well the names and argument types of the parameters. I can see the value of providing type info for polymorphic arguments, but not sure about expending extra cycles to do it for all. Alternatively, maybe the feature could be exposed in a way where you don't actually calculate the values unless requested, ie provide some sort of inquiry function instead of always precomputing a hash. regards, tom lane From pavel.stehule@gmail.com Thu Oct 28 15:39:31 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C215F1337B4F for ; Thu, 28 Oct 2010 12:40:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 20771-05 for ; Thu, 28 Oct 2010 15:40:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 73A961337B66 for ; Thu, 28 Oct 2010 12:40:20 -0300 (ADT) Received: by vws13 with SMTP id 13so346817vws.19 for ; Thu, 28 Oct 2010 08:40:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=c0LQRTyjplovZAg+DqIGXeLo8hAPoFVTaRGNuhVVcw8=; b=OrI7pQtSwi0wMJGzCNku7gKNxtgxpbLCi41WRjmnConU+x4CAfVUam1UV1GSZ8ZWZt tVhxBXsZO14AlVTCxOw2c6ID9Gjfk0pEGGuwvekFfGEJgjhEthyZMq3ENmsLwkEy99y7 zzkxZxT8lrcnN5l+kCYjTF6EYXBWVP+OJD0gs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=iNP+EYXkVbQQ5CP8UMAmi3l+hzjFtReaYnRzTzhvu84qHMfR6bfmVXxXxrefOoABV4 +btxbEg6nN6611fZMOgh9sduBxf5hvrLVj12Go25TFLrNwp+gqhLWsmsH50C3Pa4rILT 2ADK4dANkCwvs7SNqsEQxdErdOdoUwQl5O/1k= Received: by 10.42.214.211 with SMTP id hb19mr3022774icb.386.1288280418606; Thu, 28 Oct 2010 08:40:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.172.193 with HTTP; Thu, 28 Oct 2010 08:39:31 -0700 (PDT) In-Reply-To: <4CC995C2.3000704@dunslane.net> References: <4CC995C2.3000704@dunslane.net> From: Pavel Stehule Date: Thu, 28 Oct 2010 17:39:31 +0200 Message-ID: Subject: Re: plperl arginfo To: Andrew Dunstan Cc: PostgreSQL-development , Tim Bunce Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1984 X-Sequence-Number: 173024 2010/10/28 Andrew Dunstan : > While we were discussing allowing generic record type arguments to plperl > functions, Tom suggested that we should expose the type information about > the record members to plperl. I think if we do that we should probably > expand it somewhat to all arguments, so that for non-trigger functions, w= e'd > have $_ARG_INFO while could look something like this: > > { > =C2=A0=C2=A0=C2=A0 names =3D> ['arg1', undef, 'arg3' ] , # no name was su= pplied for arg2 > =C2=A0=C2=A0=C2=A0 modes =3D> ['in', 'in', 'in' ], # do we support anythi= ng other than IN ? variadic Pavel > =C2=A0=C2=A0=C2=A0 types =3D> ['integer', 'text', { name =3D> 'somecompos= ite', fields =3D> [ > 'field1', 'field2' ], types =3D> ['date', 'numeric' ] } ], > } > > Maybe we should also pass in type Oid info, too. > > I don't think this would be terribly difficult to do. > > thoughts? > > cheers > > andrew > > > > > From pavel.stehule@gmail.com Thu Oct 28 15:54:10 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 87FDF1337B43 for ; Thu, 28 Oct 2010 12:54:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 23349-10 for ; Thu, 28 Oct 2010 15:54:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id CC24A133798E for ; Thu, 28 Oct 2010 12:54:51 -0300 (ADT) Received: by gyg4 with SMTP id 4so1312728gyg.19 for ; Thu, 28 Oct 2010 08:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=kkv8Mf2DXSK5gdFp3lO9y/tAUSPdCcRNLfODh1cYKe4=; b=lyjsA1+FJRohQi1TbMIvZ7g2qgusmSNT2gN3lvwbN2j8EYN9ax5ve8oiyyO1MeGdo1 4XotsgYXEpBveuzcDEJ/4vysJtn2r6Vkod5vpUDbWOj9Rnztm4J3nNxMeIiazO33CRJM nUVxD/RgEDGKXgX8NbEjaXzq4polhmdAm7dLI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=E8/xAKc2mQtelOY52t3zPI0bKsMIJt7bdyJscsa5kO2rVt1wYIoB0SAZ3kwutj88ne Cx3xhh6LBC5gF3Eq+xH5PwcbGkznqAalMdJqWzzIvzXJ3O5tadexH4/0a1OOU9gS24Y2 xLsTrye1wQ2B4sBO6lxVInC7F7og0lE2GSpEc= Received: by 10.42.214.138 with SMTP id ha10mr2421543icb.401.1288281290762; Thu, 28 Oct 2010 08:54:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.172.193 with HTTP; Thu, 28 Oct 2010 08:54:10 -0700 (PDT) In-Reply-To: <16686.1288280351@sss.pgh.pa.us> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> From: Pavel Stehule Date: Thu, 28 Oct 2010 17:54:10 +0200 Message-ID: Subject: Re: plperl arginfo To: Tom Lane Cc: Andrew Dunstan , PostgreSQL-development , Tim Bunce Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1986 X-Sequence-Number: 173026 2010/10/28 Tom Lane : > Andrew Dunstan writes: >> =C2=A0 While we were discussing allowing generic record type arguments t= o >> plperl functions, Tom suggested that we should expose the type >> information about the record members to plperl. I think if we do that we >> should probably expand it somewhat to all arguments, so that for >> non-trigger functions, we'd have $_ARG_INFO while could look something >> like this: > >> =C2=A0 =C2=A0 { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0names =3D> ['arg1', undef, 'arg3' ] , = # no name was supplied for arg2 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0modes =3D> ['in', 'in', 'in' ], # do w= e support anything other >> =C2=A0 =C2=A0 than IN ? >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0types =3D> ['integer', 'text', { name = =3D> 'somecomposite', fields >> =C2=A0 =C2=A0 =3D> [ 'field1', 'field2' ], types =3D> ['date', 'numeric'= ] } ], >> =C2=A0 =C2=A0 } > > Hmm, I'm a bit worried about the performance implications of adding this > information. =C2=A0It seems like the value in typical cases would be mini= mal: > when you are writing the body of "myfunction(foo int, bar text)", it's > not like you don't know perfectly well the names and argument types of > the parameters. > > I can see the value of providing type info for polymorphic arguments, > but not sure about expending extra cycles to do it for all. > > Alternatively, maybe the feature could be exposed in a way where you > don't actually calculate the values unless requested, ie provide some > sort of inquiry function instead of always precomputing a hash. +1 .. some like get_function_info() Regards Pavel Stehule > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0regards, tom lane > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > From andrew@dunslane.net Thu Oct 28 16:29:22 2010 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7AB011337B43 for ; Thu, 28 Oct 2010 13:29:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 51958-04 for ; Thu, 28 Oct 2010 16:29:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.121]) by mail.postgresql.org (Postfix) with ESMTP id 52D411336DB6 for ; Thu, 28 Oct 2010 13:29:24 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=Inhw+Jdt7z1D3BivGPfn2aw54OvUEJw5lAn/booRZkE= c=1 sm=0 a=IkcTkHD0fZMA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=s5ihUIoobfPvtDA_JwcA:9 a=Mha7RCE7ShXAcNFe9Phvy-svp-MA:4 a=QEXdDO2ut3YA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:33704] helo=[192.168.10.104]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 33/84-13137-2E4A9CC4; Thu, 28 Oct 2010 16:29:23 +0000 Message-ID: <4CC9A4E2.9050604@dunslane.net> Date: Thu, 28 Oct 2010 12:29:22 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: Pavel Stehule CC: Tom Lane , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1988 X-Sequence-Number: 173028 On 10/28/2010 11:54 AM, Pavel Stehule wrote: > Alternatively, maybe the feature could be exposed in a way where you > don't actually calculate the values unless requested, ie provide some > sort of inquiry function instead of always precomputing a hash. > +1 .. some like get_function_info() > Yeah, that looks doable. I think we can just commit the generic record support now and add this on later. cheers andrew From pavel.stehule@gmail.com Thu Oct 28 16:33:53 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 51A1B1337B4F for ; Thu, 28 Oct 2010 13:35:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73480-03 for ; Thu, 28 Oct 2010 16:35:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 021CB1336DB6 for ; Thu, 28 Oct 2010 13:35:07 -0300 (ADT) Received: by vws13 with SMTP id 13so397341vws.19 for ; Thu, 28 Oct 2010 09:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=80RHxaE3gjAtPlo2O8y6esUHVzqk5Mbuz8gQOcGmOSE=; b=fMpgKEzipaCBP2iWgn3kZn340kH59jhah1dwG/czLJdDNumM2EiEwNU8N0/6IBcwds UigzZ/YfMVu8Kozw5LiRt8QjYd4IocmPP/6vSS1RqqXa2llJyup75HPY5PFTd1dBTGHh Xi9XfjARgwNRF5Q1hiyL52utaViKtNj5GcHDU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=kIC9aMkHKXvGH3dpNHdPuGkC1bG3VQ5e31qvBShho1iTuZyadrxVm/Bkw7fges2L9P 64IONV9i+6+c53kYnF/F9bZhb85J/yp0ZRusXKyD1b/9xkuS4Roi4QcUSFQ0NLFuYvYl 68q5FZ0rblS33ENhR1/Ok9VlXrsIhdz4bZ33Q= Received: by 10.42.15.67 with SMTP id k3mr8524510ica.490.1288283706948; Thu, 28 Oct 2010 09:35:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.172.193 with HTTP; Thu, 28 Oct 2010 09:33:53 -0700 (PDT) In-Reply-To: <4CC9A4E2.9050604@dunslane.net> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> From: Pavel Stehule Date: Thu, 28 Oct 2010 18:33:53 +0200 Message-ID: Subject: Re: plperl arginfo To: Andrew Dunstan Cc: Tom Lane , PostgreSQL-development , Tim Bunce Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1992 X-Sequence-Number: 173032 2010/10/28 Andrew Dunstan : > > > On 10/28/2010 11:54 AM, Pavel Stehule wrote: >> >> Alternatively, maybe the feature could be exposed in a way where you >> don't actually calculate the values unless requested, ie provide some >> sort of inquiry function instead of always precomputing a hash. >> +1 .. some like get_function_info() >> > > Yeah, that looks doable. > > I think we can just commit the generic record support now and add this on > later. this can be very interesting feature - because it can to do some things in plperi instead c. regards Pavel > > cheers > > andrew > From tgl@sss.pgh.pa.us Thu Oct 28 16:34:28 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id CBED91337B55 for ; Thu, 28 Oct 2010 13:35:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 68801-06 for ; Thu, 28 Oct 2010 16:35:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 35AC01337B43 for ; Thu, 28 Oct 2010 13:35:05 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9SGYSRd020301; Thu, 28 Oct 2010 12:34:28 -0400 (EDT) To: Andrew Dunstan cc: Pavel Stehule , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo In-reply-to: <4CC9A4E2.9050604@dunslane.net> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Thu, 28 Oct 2010 12:29:22 -0400" Date: Thu, 28 Oct 2010 12:34:28 -0400 Message-ID: <20300.1288283668@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/1991 X-Sequence-Number: 173031 Andrew Dunstan writes: > On 10/28/2010 11:54 AM, Pavel Stehule wrote: >> Alternatively, maybe the feature could be exposed in a way where you >> don't actually calculate the values unless requested, ie provide some >> sort of inquiry function instead of always precomputing a hash. >> +1 .. some like get_function_info() > Yeah, that looks doable. BTW, maybe we could have the best of both worlds? Dunno about Perl, but in some languages it would be possible to instantiate the hash only if it's actually touched. Passing the data as a hash definitely seems to fit with the spirit of things otherwise, so as long as it didn't cost cycles when not needed, I'd be in favor of that API. regards, tom lane From stephen.butler@gmail.com Thu Oct 28 16:55:48 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A8BDC1337B68 for ; Thu, 28 Oct 2010 13:55:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 06714-09 for ; Thu, 28 Oct 2010 16:55:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yw0-f46.google.com (mail-yw0-f46.google.com [209.85.213.46]) by mail.postgresql.org (Postfix) with ESMTP id 28D5E1337B64 for ; Thu, 28 Oct 2010 13:55:50 -0300 (ADT) Received: by ywk9 with SMTP id 9so1390686ywk.19 for ; Thu, 28 Oct 2010 09:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=AMiJaaiyfrqoGcLLYpn8iUnIi2lCu4p0pOM42U3UA2A=; b=s2xGk6zD2sCn7yCX4IsTmrmQDmFBkXcSOExRetT1/qB/dMVBb4yb7swTBPzEMS7MAe aWL1PfotrYbxkjLZhLCsg/82uOZogAJZqXAzXzIGKVi4iy1gekMYmSCxoIVxq60GrXrV 5umgY0lKvTRfx6DSewMKut94YdWtKZUBgWK2k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=KBIg2hXFM3vzjPt+OJ5iM6j5+Uq435Vm0L7OR+uaAFDPv5gpLmO56FvqQPFOW7vj39 N8wLMj2Kbuw9kMnDs0G3LDT+8WqjG6o5LwGjFreTHi6xlPeRrYUgQ6u2FgYPPFKivkqf P1pRm4hNqpT1kkmctYMFN19Jow3x6Ti5CPVc8= MIME-Version: 1.0 Received: by 10.239.141.71 with SMTP id b7mr1865575hba.153.1288284949146; Thu, 28 Oct 2010 09:55:49 -0700 (PDT) Received: by 10.220.46.81 with HTTP; Thu, 28 Oct 2010 09:55:48 -0700 (PDT) In-Reply-To: <20300.1288283668@sss.pgh.pa.us> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> <20300.1288283668@sss.pgh.pa.us> Date: Thu, 28 Oct 2010 11:55:48 -0500 Message-ID: Subject: Re: plperl arginfo From: "Stephen J. Butler" To: PostgreSQL-development Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1994 X-Sequence-Number: 173034 On Thu, Oct 28, 2010 at 11:34 AM, Tom Lane wrote: > Andrew Dunstan writes: >> On 10/28/2010 11:54 AM, Pavel Stehule wrote: >>> Alternatively, maybe the feature could be exposed in a way where you >>> don't actually calculate the values unless requested, ie provide some >>> sort of inquiry function instead of always precomputing a hash. >>> +1 .. some like get_function_info() > >> Yeah, that looks doable. > > BTW, maybe we could have the best of both worlds? =A0Dunno about Perl, > but in some languages it would be possible to instantiate the hash > only if it's actually touched. =A0Passing the data as a hash definitely > seems to fit with the spirit of things otherwise, so as long as it > didn't cost cycles when not needed, I'd be in favor of that API. Perl has the tie interface (perldoc perltie) which lets you tie a hash to an object instance, which implements subs to handle the various hash operations. From andrew@dunslane.net Thu Oct 28 17:03:24 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 425A41336DB6 for ; Thu, 28 Oct 2010 14:03:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 36258-04 for ; Thu, 28 Oct 2010 17:03:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by mail.postgresql.org (Postfix) with ESMTP id CF82E13364DE for ; Thu, 28 Oct 2010 14:03:25 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=Inhw+Jdt7z1D3BivGPfn2aw54OvUEJw5lAn/booRZkE= c=1 sm=0 a=8nJEP1OIZ-IA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=HZRpa_jdXoI8A9SKLTIA:9 a=pzViarLXP1bhHoGEAPUXRbVyo-oA:4 a=wPNLvfGTeEIA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:47057] helo=[192.168.10.104]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 39/0E-13137-DDCA9CC4; Thu, 28 Oct 2010 17:03:25 +0000 Message-ID: <4CC9ACDC.9090508@dunslane.net> Date: Thu, 28 Oct 2010 13:03:24 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: Tom Lane CC: Pavel Stehule , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> <20300.1288283668@sss.pgh.pa.us> In-Reply-To: <20300.1288283668@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/1996 X-Sequence-Number: 173036 On 10/28/2010 12:34 PM, Tom Lane wrote: > > BTW, maybe we could have the best of both worlds? Dunno about Perl, > but in some languages it would be possible to instantiate the hash > only if it's actually touched. Passing the data as a hash definitely > seems to fit with the spirit of things otherwise, so as long as it > didn't cost cycles when not needed, I'd be in favor of that API. Maybe, but I think that's getting rather beyond my perlguts-fu. I think we'd need to do that via PERL_MAGIC_tied, but it's new territory for me. Anyone else want to chime in? cheers andrew From ghamlin@isc.upenn.edu Thu Oct 28 18:11:05 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7EDCA1337B4F for ; Thu, 28 Oct 2010 15:11:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68158-01 for ; Thu, 28 Oct 2010 18:11:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.exchange.upenn.edu (smtp2.exchange.upenn.edu [128.91.3.225]) by mail.postgresql.org (Postfix) with ESMTP id D30701337B86 for ; Thu, 28 Oct 2010 15:11:13 -0300 (ADT) Received: from isc.upenn.edu (128.91.197.36) by smtp.exchange.upenn.edu (128.91.2.25) with Microsoft SMTP Server (TLS) id 8.2.213.0; Thu, 28 Oct 2010 14:11:11 -0400 Date: Thu, 28 Oct 2010 14:11:05 -0400 From: Garick Hamlin To: Andrew Dunstan CC: Tom Lane , Pavel Stehule , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo Message-ID: <20101028181105.GA15019@isc.upenn.edu> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> <20300.1288283668@sss.pgh.pa.us> <4CC9ACDC.9090508@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <4CC9ACDC.9090508@dunslane.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/2000 X-Sequence-Number: 173040 On Thu, Oct 28, 2010 at 01:03:24PM -0400, Andrew Dunstan wrote: > > > On 10/28/2010 12:34 PM, Tom Lane wrote: > > > > BTW, maybe we could have the best of both worlds? Dunno about Perl, > > but in some languages it would be possible to instantiate the hash > > only if it's actually touched. Passing the data as a hash definitely > > seems to fit with the spirit of things otherwise, so as long as it > > didn't cost cycles when not needed, I'd be in favor of that API. > > Maybe, but I think that's getting rather beyond my perlguts-fu. I think > we'd need to do that via PERL_MAGIC_tied, but it's new territory for me. > Anyone else want to chime in? Warning, I don't know the plperl, I am just a perl coder. I do think all the anonymous array are worth worrying about in terms of performance. I don't think that tie is necessarily good for performance. tie() is not generally fast. I think you'd likely be better off writing plain accessors or using a function to add type info. Use an accessor for type information, like this? $ref->typeof($key) ... or perhaps use a special function? add_type_info(\%args); ... or if you want attibute based syntax sugar for the add_type_info() solution... my %args : pg_record(add_type_info); Again, these I don't know the plperl code, so I might be missing something here. Garick > > cheers > > andrew > > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers From andrew@dunslane.net Thu Oct 28 18:41:36 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 76F4C133616B for ; Thu, 28 Oct 2010 15:41:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 74971-05 for ; Thu, 28 Oct 2010 18:41:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.121]) by mail.postgresql.org (Postfix) with ESMTP id C5C0A1335B36 for ; Thu, 28 Oct 2010 15:41:37 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=pepdxKapwHuwCZNFD5uob2wvham6E+RljB0uXw08FdQ= c=1 sm=0 a=8nJEP1OIZ-IA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=SMYb-vVDOJGuV9BnjLwA:9 a=OevbfcGsrbEtuPdeRm4A:7 a=D5QC383fORt8szLf2is2n0UUNbAA:4 a=wPNLvfGTeEIA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:39365] helo=[192.168.10.104]) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id FA/FB-19545-1E3C9CC4; Thu, 28 Oct 2010 18:41:37 +0000 Message-ID: <4CC9C3E0.4000706@dunslane.net> Date: Thu, 28 Oct 2010 14:41:36 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: Garick Hamlin CC: Tom Lane , Pavel Stehule , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> <20300.1288283668@sss.pgh.pa.us> <4CC9ACDC.9090508@dunslane.net> <20101028181105.GA15019@isc.upenn.edu> In-Reply-To: <20101028181105.GA15019@isc.upenn.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/2001 X-Sequence-Number: 173041 On 10/28/2010 02:11 PM, Garick Hamlin wrote: > On Thu, Oct 28, 2010 at 01:03:24PM -0400, Andrew Dunstan wrote: >> >> On 10/28/2010 12:34 PM, Tom Lane wrote: >>> BTW, maybe we could have the best of both worlds? Dunno about Perl, >>> but in some languages it would be possible to instantiate the hash >>> only if it's actually touched. Passing the data as a hash definitely >>> seems to fit with the spirit of things otherwise, so as long as it >>> didn't cost cycles when not needed, I'd be in favor of that API. >> Maybe, but I think that's getting rather beyond my perlguts-fu. I think >> we'd need to do that via PERL_MAGIC_tied, but it's new territory for me. >> Anyone else want to chime in? > Warning, I don't know the plperl, I am just a perl coder. > > I do think all the anonymous array are worth worrying about in terms of > performance. > > I don't think that tie is necessarily good for performance. tie() is not > generally fast. I think you'd likely be better off writing plain accessors > or using a function to add type info. > > Use an accessor for type information, like this? > $ref->typeof($key) > > ... > or perhaps use a special function? > > add_type_info(\%args); > > ... > or if you want attibute based syntax sugar for the add_type_info() solution... > > my %args : pg_record(add_type_info); > > Again, these I don't know the plperl code, so I might be missing something > here. > This wouldn't be done at the perl level. It would be done in C code. Run "man perlguts" and search for "Understanding the Magic of Tied Hashes and Arrays". The overhead in setting it up is likely to be very low unless I'm not understanding correctly. There might be some price paid when accessing the object, but that's another affair. OTOH, a pg_get_arg_info() function would probably be a substantially simpler if slightly less perlish solution. cheers andrew