Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 24D231337B5C for ; Fri, 10 Dec 2010 15:26:15 -0400 (AST) 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 50102-06 for ; Fri, 10 Dec 2010 19:26:08 +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 B93241336B42 for ; Fri, 10 Dec 2010 15:26:07 -0400 (AST) 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 oBAJQ6KT027792; Fri, 10 Dec 2010 14:26:06 -0500 (EST) To: Pavel Stehule cc: pgsql-bugs@postgresql.org Subject: Re: variadic flag doesn't work with "any" type In-reply-to: References: <29821.1291928919@sss.pgh.pa.us> <8691.1291934337@sss.pgh.pa.us> Comments: In-reply-to Pavel Stehule message dated "Fri, 10 Dec 2010 08:55:32 +0100" Date: Fri, 10 Dec 2010 14:26:06 -0500 Message-ID: <27791.1292009166@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: 201012/69 X-Sequence-Number: 28875 Pavel Stehule writes: > 2010/12/9 Tom Lane : >> What exactly is the use-case for that? > I am working on function that can help with record updating. It's > based on polymorphic types. I would to allow a multiple modification > per one call - like UPDATE statement does. > some like: > record_set_fields(anyelement, key text, value "any" [, key text, value > "any" [..]]) returns anyelement OK, makes sense, since you don't want to constrain the values to be all the same datatype. > sometimes can be interesting to use a VARIADIC value - so list of > pairs (key, value) can be created dynamically - (now I don't talk if > this is good way or not). That can't work unless you constrain all the values to be text (to match the column-name parameters), which more or less defeats the entire point of the function. So I see no interesting use-case for VARIADIC here. regards, tom lane