Thread

  1. hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-08T19:07:58Z

    I believe that the consensus was mostly in favor of deprecating => as
    an operator name, with the intent to abolish it completely in a future
    release.  Attached is a patch to implement ==> as an alternative
    operator name for hstore, and to make the backend throw a warning when
    => is used as an operator name.
    
    One wart is that => is used not only as a SQL-level operator, but also
    by hstore_in() when interpreting hstore-type literals, and by
    hstore_out() when generating them.  My gut feeling is that we should
    leave this part alone and only muck with the SQL operator, but perhaps
    someone will care to argue the point.
    
    http://archives.postgresql.org/pgsql-hackers/2010-05/msg01501.php
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
  2. Re: hstore ==> and deprecate =>

    Merlin Moncure <mmoncure@gmail.com> — 2010-06-08T19:34:11Z

    On Tue, Jun 8, 2010 at 3:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    > I believe that the consensus was mostly in favor of deprecating => as
    > an operator name, with the intent to abolish it completely in a future
    > release.  Attached is a patch to implement ==> as an alternative
    > operator name for hstore, and to make the backend throw a warning when
    > => is used as an operator name.
    >
    > One wart is that => is used not only as a SQL-level operator, but also
    > by hstore_in() when interpreting hstore-type literals, and by
    > hstore_out() when generating them.  My gut feeling is that we should
    > leave this part alone and only muck with the SQL operator, but perhaps
    > someone will care to argue the point.
    >
    > http://archives.postgresql.org/pgsql-hackers/2010-05/msg01501.php
    
    hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    hstore_in and the operator don't have to be the same, but requiring
    three letter token for the two most high traffic operations w/hstore
    seems off to me.
    
    # is currently used for bitwise xor/geo
    
    merlin
    
    
  3. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-08T19:38:29Z

    On Tue, Jun 8, 2010 at 3:34 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
    > On Tue, Jun 8, 2010 at 3:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    >> I believe that the consensus was mostly in favor of deprecating => as
    >> an operator name, with the intent to abolish it completely in a future
    >> release.  Attached is a patch to implement ==> as an alternative
    >> operator name for hstore, and to make the backend throw a warning when
    >> => is used as an operator name.
    >>
    >> One wart is that => is used not only as a SQL-level operator, but also
    >> by hstore_in() when interpreting hstore-type literals, and by
    >> hstore_out() when generating them.  My gut feeling is that we should
    >> leave this part alone and only muck with the SQL operator, but perhaps
    >> someone will care to argue the point.
    >>
    >> http://archives.postgresql.org/pgsql-hackers/2010-05/msg01501.php
    >
    > hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    > hstore_in and the operator don't have to be the same, but requiring
    > three letter token for the two most high traffic operations w/hstore
    > seems off to me.
    >
    > # is currently used for bitwise xor/geo
    
    I'm happy to do whatever the consensus is.  I thought it would be
    easier to remember if the two operators were spelled at least somewhat
    similarly, but I just work here.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  4. Re: hstore ==> and deprecate =>

    Pavel Stehule <pavel.stehule@gmail.com> — 2010-06-08T19:38:30Z

    2010/6/8 Merlin Moncure <mmoncure@gmail.com>:
    > On Tue, Jun 8, 2010 at 3:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    >> I believe that the consensus was mostly in favor of deprecating => as
    >> an operator name, with the intent to abolish it completely in a future
    >> release.  Attached is a patch to implement ==> as an alternative
    >> operator name for hstore, and to make the backend throw a warning when
    >> => is used as an operator name.
    >>
    >> One wart is that => is used not only as a SQL-level operator, but also
    >> by hstore_in() when interpreting hstore-type literals, and by
    >> hstore_out() when generating them.  My gut feeling is that we should
    >> leave this part alone and only muck with the SQL operator, but perhaps
    >> someone will care to argue the point.
    >>
    >> http://archives.postgresql.org/pgsql-hackers/2010-05/msg01501.php
    >
    > hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    > hstore_in and the operator don't have to be the same, but requiring
    > three letter token for the two most high traffic operations w/hstore
    > seems off to me.
    
    I am for Robert's proposal - ===> is one char longer - but
    significantly readable
    
    Regards
    
    Pavel
    
    p.s. I hope so in 9.1 will be complete hstore module marked as deprecated
    
    
    >
    > # is currently used for bitwise xor/geo
    >
    > merlin
    >
    > --
    > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
    > To make changes to your subscription:
    > http://www.postgresql.org/mailpref/pgsql-hackers
    >
    
    
  5. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-08T19:43:23Z

    Pavel Stehule <pavel.stehule@gmail.com> writes:
    > p.s. I hope so in 9.1 will be complete hstore module marked as deprecated
    
    Really?  And replaced with what?  And why wouldn't the replacement use
    the same operator names?
    
    			regards, tom lane
    
    
  6. Re: hstore ==> and deprecate =>

    Andrew Dunstan <andrew@dunslane.net> — 2010-06-08T19:54:56Z

    
    Tom Lane wrote:
    > Pavel Stehule <pavel.stehule@gmail.com> writes:
    >   
    >> p.s. I hope so in 9.1 will be complete hstore module marked as deprecated
    >>     
    >
    > Really?  And replaced with what?  And why wouldn't the replacement use
    > the same operator names?
    >
    > 			
    >   
    
    Yeah. I'll be looking for throats to cut if that happens. I have several 
    apps that use it extensively. If anything, I want it brought into core - 
    it has wide ranging usefulness.
    
    cheers
    
    andrew
    
    
  7. Re: hstore ==> and deprecate =>

    Michael Glaesemann <grzm@seespotcode.net> — 2010-06-08T19:56:11Z

    On Jun 8, 2010, at 15:38 , Robert Haas wrote:
    
    > On Tue, Jun 8, 2010 at 3:34 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
    >> hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    >> hstore_in and the operator don't have to be the same, but requiring
    >> three letter token for the two most high traffic operations w/hstore
    >> seems off to me.
    >> 
    >> # is currently used for bitwise xor/geo
    > 
    > I'm happy to do whatever the consensus is.  I thought it would be
    > easier to remember if the two operators were spelled at least somewhat
    > similarly, but I just work here.
    
    Perhaps 
    ->
    Would a colon work?
    
    (That's enough bikeshedding for me.)
    
    Michael Glaesemann
    grzm seespotcode net
    
    
    
    
    
  8. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-08T20:17:14Z

    On Tue, Jun 8, 2010 at 3:56 PM, Michael Glaesemann <grzm@seespotcode.net> wrote:
    > On Jun 8, 2010, at 15:38 , Robert Haas wrote:
    >> On Tue, Jun 8, 2010 at 3:34 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
    >>> hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    >>> hstore_in and the operator don't have to be the same, but requiring
    >>> three letter token for the two most high traffic operations w/hstore
    >>> seems off to me.
    >>>
    >>> # is currently used for bitwise xor/geo
    >>
    >> I'm happy to do whatever the consensus is.  I thought it would be
    >> easier to remember if the two operators were spelled at least somewhat
    >> similarly, but I just work here.
    >
    > Perhaps
    > ->
    
    That's already in use to mean something else.
    
    > Would a colon work?
    
    Nope.
    
    ERROR:  syntax error at or near ":"
    
    > (That's enough bikeshedding for me.)
    
    Test first, then post?  :-)
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  9. Re: hstore ==> and deprecate =>

    Michael Glaesemann <grzm@seespotcode.net> — 2010-06-08T20:28:29Z

    On Jun 8, 2010, at 16:17 , Robert Haas wrote:
    
    >> (That's enough bikeshedding for me.)
    > 
    > Test first, then post?  :-)
    
    What? :) If I was productively contributing, I wouldn't be bikeshedding, now would I? 
    
    Michael Glaesemann
    grzm seespotcode net
    
    
    
    
    
  10. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-08T21:36:50Z

    On Jun 8, 2010, at 12:34 PM, Merlin Moncure wrote:
    
    > hm.  any chance of a  shorter operator, like '#'?  I kinda agree that
    > hstore_in and the operator don't have to be the same, but requiring
    > three letter token for the two most high traffic operations w/hstore
    > seems off to me.
    > 
    > # is currently used for bitwise xor/geo
    
    Not at all the same.
    
    What about ~> ?
    
    Best,
    
    David
    
    
    
  11. Re: hstore ==> and deprecate =>

    Pavel Stehule <pavel.stehule@gmail.com> — 2010-06-09T07:14:04Z

    2010/6/8 Tom Lane <tgl@sss.pgh.pa.us>:
    > Pavel Stehule <pavel.stehule@gmail.com> writes:
    >> p.s. I hope so in 9.1 will be complete hstore module marked as deprecated
    >
    > Really?  And replaced with what?  And why wouldn't the replacement use
    > the same operator names?
    >
    
    We talked about integrated hash tables support.
    
    regards
    
    Pavel
    
    >                        regards, tom lane
    >
    
    
  12. Re: hstore ==> and deprecate =>

    Greg Stark <gsstark@mit.edu> — 2010-06-09T10:41:29Z

    On Tue, Jun 8, 2010 at 8:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    > I believe that the consensus was mostly in favor of deprecating => as
    > an operator name, with the intent to abolish it completely in a future
    > release.  Attached is a patch to implement ==> as an alternative
    > operator name for hstore, and to make the backend throw a warning when
    > => is used as an operator name.
    
    I don't think we can throw warnings for DML except in the most dire
    circumstances. In an OLTP system with high throughput a warning would
    fill the logs quickly, effectively making it impossible to use the
    syntax being warned about. If we're willing to do that we would just
    use an ERROR anyways which I don't think we're willing to do. People
    might need a transition period when they still use => because they
    need to write code which will work with either old or new versions.
    
    > One wart is that => is used not only as a SQL-level operator, but also
    > by hstore_in() when interpreting hstore-type literals, and by
    > hstore_out() when generating them.  My gut feeling is that we should
    > leave this part alone and only muck with the SQL operator, but perhaps
    > someone will care to argue the point.
    
    I hate these kinds of inconsistencies. I would prefer both operators
    be consistent.
    
    -- 
    greg
    
    
  13. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-09T10:51:41Z

    On Wed, Jun 9, 2010 at 6:41 AM, Greg Stark <gsstark@mit.edu> wrote:
    > On Tue, Jun 8, 2010 at 8:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    >> I believe that the consensus was mostly in favor of deprecating => as
    >> an operator name, with the intent to abolish it completely in a future
    >> release.  Attached is a patch to implement ==> as an alternative
    >> operator name for hstore, and to make the backend throw a warning when
    >> => is used as an operator name.
    >
    > I don't think we can throw warnings for DML except in the most dire
    > circumstances.
    
    The patch doesn't.
    
    >> One wart is that => is used not only as a SQL-level operator, but also
    >> by hstore_in() when interpreting hstore-type literals, and by
    >> hstore_out() when generating them.  My gut feeling is that we should
    >> leave this part alone and only muck with the SQL operator, but perhaps
    >> someone will care to argue the point.
    >
    > I hate these kinds of inconsistencies. I would prefer both operators
    > be consistent.
    
    Sure, me too, but I think this is the best we can do.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  14. Re: hstore ==> and deprecate =>

    Dimitri Fontaine <dfontaine@hi-media.com> — 2010-06-09T10:53:43Z

    Greg Stark <gsstark@mit.edu> writes:
    > On Tue, Jun 8, 2010 at 8:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    >> I believe that the consensus was mostly in favor of deprecating => as
    >> an operator name, with the intent to abolish it completely in a future
    >> release.  Attached is a patch to implement ==> as an alternative
    >> operator name for hstore, and to make the backend throw a warning when
    >> => is used as an operator name.
    >
    > I don't think we can throw warnings for DML except in the most dire
    > circumstances. 
    
    What about a WARNING at CREATE OPERATOR time?
    
    >> One wart is that => is used not only as a SQL-level operator, but also
    >> by hstore_in() when interpreting hstore-type literals, and by
    >> hstore_out() when generating them.  My gut feeling is that we should
    >> leave this part alone and only muck with the SQL operator, but perhaps
    >> someone will care to argue the point.
    >
    > I hate these kinds of inconsistencies. I would prefer both operators
    > be consistent.
    
    dim=# select 'foo' => 'bar', 'foo => bar'::hstore;
       ?column?   |    hstore    
    --------------+--------------
     "foo"=>"bar" | "foo"=>"bar"
    (1 ligne)
    
    Well it's not an operator in the second case, it's part of the input
    "language" of the datatype. So consistency would be good enough if we
    had both the legacy input syntax support and the new one, right?
    
    Regards,
    -- 
    dim
    
    
  15. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-09T11:09:24Z

    On Wed, Jun 9, 2010 at 6:53 AM, Dimitri Fontaine <dfontaine@hi-media.com> wrote:
    > Greg Stark <gsstark@mit.edu> writes:
    >> On Tue, Jun 8, 2010 at 8:07 PM, Robert Haas <robertmhaas@gmail.com> wrote:
    >>> I believe that the consensus was mostly in favor of deprecating => as
    >>> an operator name, with the intent to abolish it completely in a future
    >>> release.  Attached is a patch to implement ==> as an alternative
    >>> operator name for hstore, and to make the backend throw a warning when
    >>> => is used as an operator name.
    >>
    >> I don't think we can throw warnings for DML except in the most dire
    >> circumstances.
    >
    > What about a WARNING at CREATE OPERATOR time?
    
    That's what the patch I sent already does.
    
    >>> One wart is that => is used not only as a SQL-level operator, but also
    >>> by hstore_in() when interpreting hstore-type literals, and by
    >>> hstore_out() when generating them.  My gut feeling is that we should
    >>> leave this part alone and only muck with the SQL operator, but perhaps
    >>> someone will care to argue the point.
    >>
    >> I hate these kinds of inconsistencies. I would prefer both operators
    >> be consistent.
    >
    > dim=# select 'foo' => 'bar', 'foo => bar'::hstore;
    >   ?column?   |    hstore
    > --------------+--------------
    >  "foo"=>"bar" | "foo"=>"bar"
    > (1 ligne)
    >
    > Well it's not an operator in the second case, it's part of the input
    > "language" of the datatype. So consistency would be good enough if we
    > had both the legacy input syntax support and the new one, right?
    
    I'm not following this part.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  16. Re: hstore ==> and deprecate =>

    Dimitri Fontaine <dfontaine@hi-media.com> — 2010-06-09T13:06:10Z

    Robert Haas <robertmhaas@gmail.com> writes:
    >> What about a WARNING at CREATE OPERATOR time?
    >
    > That's what the patch I sent already does.
    
    Great :)
    I read comments in the email instead of the commit…
    
    > I'm not following this part.
    
    I'm wondering if deprecating => as an SQL operator, we should too
    deprecate its usage in input text for hstore. I don't think so.
    
    -- 
    Dimitri Fontaine
    PostgreSQL DBA, Architecte
    
    
  17. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-09T13:33:02Z

    On Wed, Jun 9, 2010 at 9:06 AM, Dimitri Fontaine <dfontaine@hi-media.com> wrote:
    > Robert Haas <robertmhaas@gmail.com> writes:
    >>> What about a WARNING at CREATE OPERATOR time?
    >>
    >> That's what the patch I sent already does.
    >
    > Great :)
    > I read comments in the email instead of the commit…
    >
    >> I'm not following this part.
    >
    > I'm wondering if deprecating => as an SQL operator, we should too
    > deprecate its usage in input text for hstore. I don't think so.
    
    I don't think so, either.  The most someone might want to do is make
    ==> work wherever => does now, but I wouldn't want to start monkeying
    with that without some input from Andrew Gierth; and I don't think
    it's a stop-ship issue for 9.0.
    
    Unless there is more than one vote for some alternative other than
    what I've done here (which so far there isn't), I'm going to add some
    docs to this patch and commit it later today.  Because the SQL
    committee has standardized an incompatible syntax, there are no
    perfect alternatives here.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  18. Re: hstore ==> and deprecate =>

    Andrew Gierth <andrew@tao11.riddles.org.uk> — 2010-06-09T16:02:03Z

    >>>>> "Robert" == Robert Haas <robertmhaas@gmail.com> writes:
    
     Robert> I don't think so, either.  The most someone might want to do
     Robert> is make ==> work wherever => does now, but I wouldn't want to
     Robert> start monkeying with that without some input from Andrew
     Robert> Gierth; and I don't think it's a stop-ship issue for 9.0.
    
    I'd really like to find a better operator name than ==>. But I'm not
    convinced one exists.
    
    While I don't like the inconsistency between ==> or whatever and the use
    of => in type input and output, I regard the text representation as being
    much harder to change safely, since client code will be parsing it. In this
    case the inconsistency seems like a much smaller problem than changing the
    text representation.
    
    -- 
    Andrew (irc:RhodiumToad)
    
    
  19. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-09T16:02:27Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > +	if (!strcmp(oprName, "=>"))
    
    BTW, project standard is to spell that like
    
    > +	if (strcmp(oprName, "=>") == 0)
    
    The other way looks confusingly like a "not equal" test.
    
    > +				(errmsg("The use of => as an operator name is deprecated and may be disallowed in a future release.")));
    
    Also, this doesn't follow message style guidelines.  Possibly better:
    
    	errmsg("=> is deprecated as an operator name"),
    	errdetail("This name may be disallowed altogether in future versions of PostgreSQL.")
    
    			regards, tom lane
    
    
  20. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-09T16:30:24Z

    Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
    > I'd really like to find a better operator name than ==>. But I'm not
    > convinced one exists.
    
    I agree.
    
    > While I don't like the inconsistency between ==> or whatever and the use
    > of => in type input and output, I regard the text representation as being
    > much harder to change safely, since client code will be parsing it. In this
    > case the inconsistency seems like a much smaller problem than changing the
    > text representation.
    
    Perhaps it would be sane to make hstore_in accept either => or ==>, but
    not change hstore_out (for now)?
    
    			regards, tom lane
    
    
  21. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-09T16:54:24Z

    On Jun 9, 2010, at 9:30 AM, Tom Lane wrote:
    
    > Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
    >> I'd really like to find a better operator name than ==>. But I'm not
    >> convinced one exists.
    > 
    > I agree.
    
    +1
    
    No one liked my suggestion of ~> ? Too similar to -> ? Other ideas:
    
      'foo' :> 'bar'
    
      'foo' @> 'bar'
    
      'foo' #> 'bar'
    
      'foo' &> 'bar'
    
      'foo' *> 'bar'
    
      'foo' +> 'bar'
    
      'foo' > 'bar'
    
      'bar' <= 'foo'
    
    I actually like :> pretty well. It looks more like =>, and has nice correspondence to := for named function params.
    
    Hey, why not Unicode?
    
      'bar' ➡ 'foo'
    
    ;-)
    
    > Perhaps it would be sane to make hstore_in accept either => or ==>, but
    > not change hstore_out (for now)?
    
    +1
    
    David
    
    
    
    
  22. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-09T16:58:11Z

    On Wed, Jun 9, 2010 at 12:54 PM, David E. Wheeler <david@kineticode.com> wrote:
    >> Perhaps it would be sane to make hstore_in accept either => or ==>, but
    >> not change hstore_out (for now)?
    >
    > +1
    
    Anyone want to take a crack at coding that?  I took a brief look at
    the code but it looked a bit intimidating at first glance.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  23. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-09T17:04:54Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > I actually like :> pretty well. It looks more like =>, and has nice correspondence to := for named function params.
    
    Colon was removed from the set of allowed operator-name characters years
    ago.  There are conflicts with various usages (ecpg & psql variables).
    This is actually a place where the current := behavior could cause some
    issues, though I'm not aware of any at the moment.
    
    			regards, tom lane
    
    
  24. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-09T17:15:17Z

    On Jun 9, 2010, at 10:04 AM, Tom Lane wrote:
    
    >> I actually like :> pretty well. It looks more like =>, and has nice correspondence to := for named function params.
    > 
    > Colon was removed from the set of allowed operator-name characters years
    > ago.  There are conflicts with various usages (ecpg & psql variables).
    > This is actually a place where the current := behavior could cause some
    > issues, though I'm not aware of any at the moment.
    
    Oh, that's a shame.
    
    In that case, how about:
    
     'foo' >> 'bar'
    
    Best,
    
    David
    
    
    
  25. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-09T17:33:10Z

    On Wed, Jun 9, 2010 at 1:15 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 9, 2010, at 10:04 AM, Tom Lane wrote:
    >
    >>> I actually like :> pretty well. It looks more like =>, and has nice correspondence to := for named function params.
    >>
    >> Colon was removed from the set of allowed operator-name characters years
    >> ago.  There are conflicts with various usages (ecpg & psql variables).
    >> This is actually a place where the current := behavior could cause some
    >> issues, though I'm not aware of any at the moment.
    >
    > Oh, that's a shame.
    >
    > In that case, how about:
    >
    >  'foo' >> 'bar'
    
    Well, that doesn't look much like an arrow, at least not to me...
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  26. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-09T17:41:09Z

    On Jun 9, 2010, at 10:33 AM, Robert Haas wrote:
    
    > Well, that doesn't look much like an arrow, at least not to me...
    
    It's a pointer, though. Not in the C sense, of course. But I often use » for "read more" style links in HTML. Its the same idea: move from this to that.
    
    Anyway, for comparison's purpose:
    
      'foo' ==> 'bar'
      'foo' >> 'bar'
    
    Pity about :>.
    
    Best,
    
    David
    
    
    
  27. Re: hstore ==> and deprecate =>

    Andrew Gierth <andrew@tao11.riddles.org.uk> — 2010-06-09T18:29:47Z

    >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
    
     >> While I don't like the inconsistency between ==> or whatever and
     >> the use of => in type input and output, I regard the text
     >> representation as being much harder to change safely, since client
     >> code will be parsing it. In this case the inconsistency seems like
     >> a much smaller problem than changing the text representation.
    
     Tom> Perhaps it would be sane to make hstore_in accept either => or
     Tom> ==>, but not change hstore_out (for now)?
    
    I'd be happy with that.
    
    -- 
    Andrew (irc:RhodiumToad)
    
    
  28. Re: hstore ==> and deprecate =>

    Merlin Moncure <mmoncure@gmail.com> — 2010-06-09T19:22:22Z

    On Wed, Jun 9, 2010 at 1:15 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 9, 2010, at 10:04 AM, Tom Lane wrote:
    >
    >>> I actually like :> pretty well. It looks more like =>, and has nice correspondence to := for named function params.
    >>
    >> Colon was removed from the set of allowed operator-name characters years
    >> ago.  There are conflicts with various usages (ecpg & psql variables).
    >> This is actually a place where the current := behavior could cause some
    >> issues, though I'm not aware of any at the moment.
    >
    > Oh, that's a shame.
    >
    > In that case, how about:
    >
    >  'foo' >> 'bar'
    
    +1
    
    merlin
    
    
  29. Re: hstore ==> and deprecate =>

    Peter Eisentraut <peter_e@gmx.net> — 2010-06-11T06:51:55Z

    On tis, 2010-06-08 at 16:17 -0400, Robert Haas wrote:
    > > Perhaps
    > > ->
    > 
    > That's already in use to mean something else.
    
    Btw., the SQL standard also defines -> for something else, so if you
    wanted to be really visionary, you could deprecate that one as an
    operator at the same time.
    
    
    
  30. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-11T11:10:56Z

    On Fri, Jun 11, 2010 at 2:51 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
    > On tis, 2010-06-08 at 16:17 -0400, Robert Haas wrote:
    >> > Perhaps
    >> > ->
    >>
    >> That's already in use to mean something else.
    >
    > Btw., the SQL standard also defines -> for something else, so if you
    > wanted to be really visionary, you could deprecate that one as an
    > operator at the same time.
    
    Ouch.  What does it define it to mean?
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  31. Re: hstore ==> and deprecate =>

    Peter Eisentraut <peter_e@gmx.net> — 2010-06-11T11:35:26Z

    On fre, 2010-06-11 at 07:10 -0400, Robert Haas wrote:
    > On Fri, Jun 11, 2010 at 2:51 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
    > > On tis, 2010-06-08 at 16:17 -0400, Robert Haas wrote:
    > >> > Perhaps
    > >> > ->
    > >>
    > >> That's already in use to mean something else.
    > >
    > > Btw., the SQL standard also defines -> for something else, so if you
    > > wanted to be really visionary, you could deprecate that one as an
    > > operator at the same time.
    > 
    > Ouch.  What does it define it to mean?
    
    Similar to C: Dereferencing a reference and accessing a member.
    
    
    
  32. Re: hstore ==> and deprecate =>

    Peter Eisentraut <peter_e@gmx.net> — 2010-06-11T11:49:59Z

    On tis, 2010-06-08 at 15:38 -0400, Robert Haas wrote:
    > I'm happy to do whatever the consensus is.  I thought it would be
    > easier to remember if the two operators were spelled at least somewhat
    > similarly, but I just work here.
    
    How about no operator at all?  It won't be as cool to read, but
    consider, the arguments are text and text, not involving any hstore type
    at all, so whatever operator you choose is in practice blocked from
    everyone everywhere.  No one could ever implement another key/value
    system that uses a similar interface.  Or use the operator for anything
    else involving strings.
    
    Why not just write:
    
    hstore('this', 'that')
    hstore(key := 'this', value := 'that')
    
    
    
  33. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-11T14:57:42Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    >>> Btw., the SQL standard also defines -> for something else, so if you
    >>> wanted to be really visionary, you could deprecate that one as an
    >>> operator at the same time.
    >> 
    >> Ouch.  What does it define it to mean?
    
    > Similar to C: Dereferencing a reference and accessing a member.
    
    But a reference would be a datatype no?  So we could just regard that as
    an ordinary operator.  I don't see a reason why it would conflict with
    use of the same operator name for other datatypes (unlike the situation
    with =>).
    
    			regards, tom lane
    
    
  34. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-11T14:59:43Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    > How about no operator at all?  It won't be as cool to read, but
    > consider, the arguments are text and text, not involving any hstore type
    > at all, so whatever operator you choose is in practice blocked from
    > everyone everywhere.  No one could ever implement another key/value
    > system that uses a similar interface.  Or use the operator for anything
    > else involving strings.
    
    Yeah, that's a good point.  Maybe we should just deprecate the operator
    altogether.
    
    			regards, tom lane
    
    
  35. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-11T15:36:31Z

    On Jun 11, 2010, at 7:59 AM, Tom Lane wrote:
    
    >> How about no operator at all?  It won't be as cool to read, but
    >> consider, the arguments are text and text, not involving any hstore type
    >> at all, so whatever operator you choose is in practice blocked from
    >> everyone everywhere.  No one could ever implement another key/value
    >> system that uses a similar interface.  Or use the operator for anything
    >> else involving strings.
    > 
    > Yeah, that's a good point.  Maybe we should just deprecate the operator
    > altogether.
    
    That would make it so that the use of => in hstore strings would be less consistent. Makes sense to me.
    
    Best,
    
    David
    
  36. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-11T16:58:47Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > On Jun 11, 2010, at 7:59 AM, Tom Lane wrote:
    >> Yeah, that's a good point.  Maybe we should just deprecate the operator
    >> altogether.
    
    > That would make it so that the use of => in hstore strings would be less consistent. Makes sense to me.
    
    Less inconsistent, ITYM?  But yeah, then we would have no reason to
    fiddle with hstore_in, which is good.
    
    			regards, tom lane
    
    
  37. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-11T16:59:34Z

    On Jun 11, 2010, at 9:58 AM, Tom Lane wrote:
    
    >> That would make it so that the use of => in hstore strings would be less consistent. Makes sense to me.
    > 
    > Less inconsistent, ITYM?  But yeah, then we would have no reason to
    > fiddle with hstore_in, which is good.
    
    Yes, sorry.
    
    David
    
    
    
  38. Re: hstore ==> and deprecate =>

    Joseph Adams <joeyadams3.14159@gmail.com> — 2010-06-11T20:58:37Z

    On Fri, Jun 11, 2010 at 10:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > Peter Eisentraut <peter_e@gmx.net> writes:
    >> How about no operator at all?  It won't be as cool to read, but
    >> consider, the arguments are text and text, not involving any hstore type
    >> at all, so whatever operator you choose is in practice blocked from
    >> everyone everywhere.  No one could ever implement another key/value
    >> system that uses a similar interface.  Or use the operator for anything
    >> else involving strings.
    >
    > Yeah, that's a good point.  Maybe we should just deprecate the operator
    > altogether.
    >
    >                        regards, 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
    >
    
    To repeat an earlier question (which was in turn repeating an earlier
    question), would it be possible to do one of these, yielding '
    "key"=>"this", "key2"=>"that" '::hstore  :
    
    hstore(key := 'this', key2 := 'that')
    hstore(key => 'this', key2 => 'that')
    hstore(row('this' AS key, 'that' AS key2))
    
    In my opinion, it's important to find a reasonably elegant way to
    express hstore literals (rather than something like
    hstore(hstore_kvp('key', 'this'), hstore_kvp('key2', 'that')) )
    because something so basic shouldn't be so difficult to work with.
    It'd be a bonus if there was a general form for arbitrary named
    parameters that new functions could opt-in on (in particular,
    json_object :-) ).
    
    This type of function could be created by saying something like:
    
    CREATE FUNCTION hstore(NAMED) RETURNS hstore AS ...
    -- NAMED would be a new argtype
    
    Also, if a user needs to name a field from a variable, perhaps there
    should be a syntax that allows it, such as:
    
    hstore(pg_deref(var) => 'this', pg_deref(var2) => 'that')
    
    If implementing pg_deref would be problematic in general, perhaps it
    could initially just be supported in keys of functions like this.
    
    Only if we allow for functions with named parameters in this fashion
    would I say +1 for deprecating the => operator from hstore without a
    replacement operator like ==> .
    
    
    Joey Adams
    
    
  39. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-11T21:23:34Z

    Joseph Adams <joeyadams3.14159@gmail.com> writes:
    > To repeat an earlier question (which was in turn repeating an earlier
    > question), would it be possible to do one of these, yielding '
    > "key"=>"this", "key2"=>"that" '::hstore  :
    
    > hstore(key := 'this', key2 := 'that')
    > hstore(key => 'this', key2 => 'that')
    > hstore(row('this' AS key, 'that' AS key2))
    
    The last of those is probably the easiest to get to.  We already have
    hstore_from_record:
    
    contrib_regression=# select hstore(row('this', 'that'));    
               hstore           
    ----------------------------
     "f1"=>"this", "f2"=>"that"
    (1 row)
    
    and the only thing lacking is an easy way to specify the column names
    associated with the anonymous record type.  Extending the ROW()
    construct with AS labels as suggested above might be a reasonable way.
    
    			regards, tom lane
    
    
  40. Re: hstore ==> and deprecate =>

    Merlin Moncure <mmoncure@gmail.com> — 2010-06-12T01:00:44Z

    On Fri, Jun 11, 2010 at 5:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > Joseph Adams <joeyadams3.14159@gmail.com> writes:
    >> To repeat an earlier question (which was in turn repeating an earlier
    >> question), would it be possible to do one of these, yielding '
    >> "key"=>"this", "key2"=>"that" '::hstore  :
    >
    >> hstore(key := 'this', key2 := 'that')
    >> hstore(key => 'this', key2 => 'that')
    >> hstore(row('this' AS key, 'that' AS key2))
    >
    > The last of those is probably the easiest to get to.  We already have
    > hstore_from_record:
    >
    > contrib_regression=# select hstore(row('this', 'that'));
    >           hstore
    > ----------------------------
    >  "f1"=>"this", "f2"=>"that"
    > (1 row)
    >
    > and the only thing lacking is an easy way to specify the column names
    > associated with the anonymous record type.  Extending the ROW()
    > construct with AS labels as suggested above might be a reasonable way.
    
    +1
    
    A couple of people were just requesting that very thing (ROW/AS) on
    the IRC channel today.  row() is a pretty useful mechanism and it
    would be nice to have it more defensible vs. table changes.
    
    merlin
    
    
  41. Re: hstore ==> and deprecate =>

    Peter Eisentraut <peter_e@gmx.net> — 2010-06-12T08:04:11Z

    On fre, 2010-06-11 at 10:57 -0400, Tom Lane wrote:
    > Peter Eisentraut <peter_e@gmx.net> writes:
    > >>> Btw., the SQL standard also defines -> for something else, so if you
    > >>> wanted to be really visionary, you could deprecate that one as an
    > >>> operator at the same time.
    > >> 
    > >> Ouch.  What does it define it to mean?
    > 
    > > Similar to C: Dereferencing a reference and accessing a member.
    > 
    > But a reference would be a datatype no?  So we could just regard that as
    > an ordinary operator.  I don't see a reason why it would conflict with
    > use of the same operator name for other datatypes (unlike the situation
    > with =>).
    
    The right side of the -> would be an identifier, like
    
    (some expr yielding a ref)->attribute
    
    or
    
    objref->method(args)
    
    
    
    
  42. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-12T12:57:42Z

    Peter Eisentraut <peter_e@gmx.net> writes:
    > On fre, 2010-06-11 at 10:57 -0400, Tom Lane wrote:
    >> But a reference would be a datatype no?  So we could just regard that as
    >> an ordinary operator.  I don't see a reason why it would conflict with
    >> use of the same operator name for other datatypes (unlike the situation
    >> with =>).
    
    > The right side of the -> would be an identifier, like
    > (some expr yielding a ref)->attribute
    > or
    > objref->method(args)
    
    Yeah, but the *left* side still has to be a special datatype that
    doesn't exist today.  So we have at least some chance of not usurping
    existing usages of the operator name.  In principle you could have
    transformAExprOp transform the left side and then check for this case
    before trying to transform the right side.
    
    (And in any case, I haven't noticed anybody expressing any interest
    in implementing that part of the spec.)
    
    But actually, there's another issue here: hstore defines not one but
    three => operators:
    
    	text => text		yields hstore (with 1 element)
    	text[] => text[]	yields hstore (with N elements)
    	hstore => text[]	yields hstore (subset)
    
    It's reasonable to say that the first two are bad design, but I'm
    a bit less willing to say that the last one is.  What shall we
    do with that?
    
    			regards, tom lane
    
    
  43. Re: hstore ==> and deprecate =>

    Florian Pflug <fgp@phlo.org> — 2010-06-12T14:15:54Z

    On Jun 12, 2010, at 14:57 , Tom Lane wrote:
    > But actually, there's another issue here: hstore defines not one but
    > three => operators:
    > 
    > 	text => text		yields hstore (with 1 element)
    > 	text[] => text[]	yields hstore (with N elements)
    > 	hstore => text[]	yields hstore (subset)
    > 
    > It's reasonable to say that the first two are bad design, but I'm
    > a bit less willing to say that the last one is.  What shall we
    > do with that?
    
    Hm, the last one seems to be more akin to
            hstore - text        yields hstore (key removed)
            hstore - text[]      yields hstore (keys in array removed)
            hstore - hstore      yields hstore (keys in hstore removed)
    
    since it's not a constructor like the first two, but rather an (intersection-like) operation on an existing hstore.
    
    Inspired by the already existing
            hstore ?& text[]     yields boolean (true if set of keys subset of array)
    I suggest
            hstore & text[]
    as a replacement.
    
    best regards,
    Florian Pflug
    
    
    
  44. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-12T16:23:44Z

    On Jun 11, 2010, at 2:23 PM, Tom Lane wrote:
    
    >> hstore(key := 'this', key2 := 'that')
    >> hstore(key => 'this', key2 => 'that')
    >> hstore(row('this' AS key, 'that' AS key2))
    > 
    > The last of those is probably the easiest to get to.  We already have
    > hstore_from_record:
    
    Is not the first one simply a function with any number of named params?
    
    Best,
    
    David
    
    
  45. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-12T16:29:11Z

    On Jun 12, 2010, at 7:15 AM, Florian Pflug wrote:
    
    >> It's reasonable to say that the first two are bad design, but I'm
    >> a bit less willing to say that the last one is.  What shall we
    >> do with that?
    > 
    > Hm, the last one seems to be more akin to
    >        hstore - text        yields hstore (key removed)
    >        hstore - text[]      yields hstore (keys in array removed)
    >        hstore - hstore      yields hstore (keys in hstore removed)
    
    Well, no, the keys aren't removed: you get back an hstore with only those keys (the lhs is unchanged).
    
    > since it's not a constructor like the first two, but rather an (intersection-like) operation on an existing hstore.
    > 
    > Inspired by the already existing
    >        hstore ?& text[]     yields boolean (true if set of keys subset of array)
    > I suggest
    >        hstore & text[]
    > as a replacement.
    
    Yes, agreed.
    
    That just leaves
    
    	text[] => text[]	yields hstore (with N elements)
    
    Which, IIRC, is new in 9.1, so could in theory be removed, especially if there was an
    
            hstore(text[], text[])
    
    Best,
    
    David
    
  46. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-12T17:01:02Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > On Jun 11, 2010, at 2:23 PM, Tom Lane wrote:
    >>> hstore(key := 'this', key2 := 'that')
    >>> hstore(key => 'this', key2 => 'that')
    >>> hstore(row('this' AS key, 'that' AS key2))
    >> 
    >> The last of those is probably the easiest to get to.  We already have
    >> hstore_from_record:
    
    > Is not the first one simply a function with any number of named params?
    
    No, because the desire presumably would be to be able to use any set of
    parameter names with that one function ... which absolutely flies in the
    face of our current notion of what a parameter name means.  You'd
    essentially have to disable the ability to have function overloading.
    (Which probably means it Ain't Happening.)
    
    			regards, tom lane
    
    
  47. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-12T17:21:03Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > Which, IIRC, is new in 9.1, so could in theory be removed, especially if there was an
    >         hstore(text[], text[])
    
    Oh --- now that I look, both that and the hstore => text[] one are new
    in 9.0, which means it is not too late to reverse course.  So at this
    point the proposal is:
    
    * Leave the text => text operator alone for now, but deprecate it,
    and document/recommend the underlying hstore(text,text) function
    instead.
    
    * Get rid of the new text[] => text[] operator altogether, and
    provide/document only the underlying hstore(text[], text[])
    function.
    
    * Rename the new hstore => text[] operator to something else.
    (I'm not quite sold on Florian's & proposal, but don't have a
    better idea to offer offhand.)
    
    
    I notice that in 8.4 and before, the function underlying text => text
    wasn't called hstore() but tconvert().  Which is going to be a serious
    PITA for anyone who wants to write cross-version-compatible SQL using
    hstore.  Can we do anything about this?  I don't think we want to revert
    to calling it tconvert().  Can we retroactively add the alternate name
    hstore() to previous versions, and suggest that people do that manually
    in existing hstore installations?
    
    			regards, tom lane
    
    
  48. Re: hstore ==> and deprecate =>

    Bruce Momjian <bruce@momjian.us> — 2010-06-12T17:28:06Z

    Tom Lane wrote:
    > I notice that in 8.4 and before, the function underlying text => text
    > wasn't called hstore() but tconvert().  Which is going to be a serious
    > PITA for anyone who wants to write cross-version-compatible SQL using
    > hstore.  Can we do anything about this?  I don't think we want to revert
    > to calling it tconvert().  Can we retroactively add the alternate name
    > hstore() to previous versions, and suggest that people do that manually
    > in existing hstore installations?
    
    In general, I don't think we make enough use of supplying
    backward-compatible SQL scripts to fix things, so +1.  Let's use the
    object-relational features we have to make things easier for users.
    
    -- 
      Bruce Momjian  <bruce@momjian.us>        http://momjian.us
      EnterpriseDB                             http://enterprisedb.com
    
      + None of us is going to be here forever. +
    
    
  49. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-12T17:32:30Z

    On Jun 12, 2010, at 10:21 AM, Tom Lane wrote:
    
    > "David E. Wheeler" <david@kineticode.com> writes:
    >> Which, IIRC, is new in 9.1, so could in theory be removed, especially if there was an
    >>        hstore(text[], text[])
    > 
    > Oh --- now that I look, both that and the hstore => text[] one are new
    > in 9.0, which means it is not too late to reverse course.  So at this
    > point the proposal is:
    > 
    > * Leave the text => text operator alone for now, but deprecate it,
    > and document/recommend the underlying hstore(text,text) function
    > instead.
    > 
    > * Get rid of the new text[] => text[] operator altogether, and
    > provide/document only the underlying hstore(text[], text[])
    > function.
    > 
    > * Rename the new hstore => text[] operator to something else.
    > (I'm not quite sold on Florian's & proposal, but don't have a
    > better idea to offer offhand.)
    
    +1
    
    > I notice that in 8.4 and before, the function underlying text => text
    > wasn't called hstore() but tconvert().  Which is going to be a serious
    > PITA for anyone who wants to write cross-version-compatible SQL using
    > hstore.  Can we do anything about this?  I don't think we want to revert
    > to calling it tconvert().  Can we retroactively add the alternate name
    > hstore() to previous versions, and suggest that people do that manually
    > in existing hstore installations?
    
    +1
    
    Best,
    
    David
    
    
    
  50. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-14T17:02:55Z

    On Sat, Jun 12, 2010 at 1:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > "David E. Wheeler" <david@kineticode.com> writes:
    >> Which, IIRC, is new in 9.1, so could in theory be removed, especially if there was an
    >>         hstore(text[], text[])
    >
    > Oh --- now that I look, both that and the hstore => text[] one are new
    > in 9.0, which means it is not too late to reverse course.  So at this
    > point the proposal is:
    >
    > * Leave the text => text operator alone for now, but deprecate it,
    > and document/recommend the underlying hstore(text,text) function
    > instead.
    >
    > * Get rid of the new text[] => text[] operator altogether, and
    > provide/document only the underlying hstore(text[], text[])
    > function.
    >
    > * Rename the new hstore => text[] operator to something else.
    > (I'm not quite sold on Florian's & proposal, but don't have a
    > better idea to offer offhand.)
    >
    >
    > I notice that in 8.4 and before, the function underlying text => text
    > wasn't called hstore() but tconvert().  Which is going to be a serious
    > PITA for anyone who wants to write cross-version-compatible SQL using
    > hstore.  Can we do anything about this?  I don't think we want to revert
    > to calling it tconvert().  Can we retroactively add the alternate name
    > hstore() to previous versions, and suggest that people do that manually
    > in existing hstore installations?
    
    Here's a patch that removes the text[] => text[] operator - as
    suggested above - and instead documents hstore(text[], text[]).
    Barring objections, I will commit this and then start looking at the
    other portions of this proposal.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
  51. Re: hstore ==> and deprecate =>

    Andrew Gierth <andrew@tao11.riddles.org.uk> — 2010-06-14T20:35:45Z

    >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
    
     Tom> But actually, there's another issue here: hstore defines not one
     Tom> but three => operators:
    
     Tom> 	text => text		yields hstore (with 1 element)
     Tom> 	text[] => text[]	yields hstore (with N elements)
     Tom> 	hstore => text[]	yields hstore (subset)
    
     Tom> It's reasonable to say that the first two are bad design, but
     Tom> I'm a bit less willing to say that the last one is.  What shall
     Tom> we do with that?
    
    I added the second two primarily by analogy with the first; following
    the existing pattern seemed to be the way to go at the time.
    
    If the first (text => text) operator hadn't already been present when I
    started looking at it, I'd probably have stuck to hstore() for all
    construction methods rather than defining an operator. Creating operators
    that take only existing builtin types is obviously a namespace problem in
    that multiple independent modules might get into trouble by choosing the
    same operators. Perhaps this should be formalized as some sort of style
    guideline for module authors?
    
    I'm happy with deprecating the first two => in favour of hstore() if
    that is in line with general opinion. The hstore => text[] slice could
    be replaced by another operator name; the existing name comes from the
    analogy that (hstore -> text[]) returns the list of values, whereas
    (hstore => text[]) returns both the keys and values.
    
    -- 
    Andrew (irc:RhodiumToad)
    
    
  52. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-15T22:13:00Z

    On Mon, Jun 14, 2010 at 4:35 PM, Andrew Gierth
    <andrew@tao11.riddles.org.uk> wrote:
    > I'm happy with deprecating the first two => in favour of hstore() if
    > that is in line with general opinion. The hstore => text[] slice could
    > be replaced by another operator name; the existing name comes from the
    > analogy that (hstore -> text[]) returns the list of values, whereas
    > (hstore => text[]) returns both the keys and values.
    
    So, I kind of like Florian Pflug's suggestion upthread of replacing
    hstore => text by hstore & text[].  I think that's about as mnemonic
    as we're likely to get, and it gels nicely with the hstore ?& text[]
    operator, which tests whether all of the named keys are present in the
    hstore.
    
    Does anyone want to bikeshed further before I go do that?
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  53. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-16T01:04:07Z

    On Jun 15, 2010, at 3:13 PM, Robert Haas wrote:
    
    > On Mon, Jun 14, 2010 at 4:35 PM, Andrew Gierth
    > <andrew@tao11.riddles.org.uk> wrote:
    >> I'm happy with deprecating the first two => in favour of hstore() if
    >> that is in line with general opinion. The hstore => text[] slice could
    >> be replaced by another operator name; the existing name comes from the
    >> analogy that (hstore -> text[]) returns the list of values, whereas
    >> (hstore => text[]) returns both the keys and values.
    > 
    > So, I kind of like Florian Pflug's suggestion upthread of replacing
    > hstore => text by hstore & text[].  I think that's about as mnemonic
    > as we're likely to get, and it gels nicely with the hstore ?& text[]
    > operator, which tests whether all of the named keys are present in the
    > hstore.
    > 
    > Does anyone want to bikeshed further before I go do that?
    
    Yeah. It actually doesn't make much sense to me. ?& is all about the keys and their presence, not the values. -> is a much better parallel, it being that it returns the keys in the rhs array. So I think something closer to it would be better. Some suggestions:
    
      ~>
      <-
      #>
      +>
    
    Ooh, I like +>, as being: give me more than -> does.
    
    Best,
    
    David
    
    
    
  54. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-16T01:58:23Z

    On Tue, Jun 15, 2010 at 9:04 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 15, 2010, at 3:13 PM, Robert Haas wrote:
    >
    >> On Mon, Jun 14, 2010 at 4:35 PM, Andrew Gierth
    >> <andrew@tao11.riddles.org.uk> wrote:
    >>> I'm happy with deprecating the first two => in favour of hstore() if
    >>> that is in line with general opinion. The hstore => text[] slice could
    >>> be replaced by another operator name; the existing name comes from the
    >>> analogy that (hstore -> text[]) returns the list of values, whereas
    >>> (hstore => text[]) returns both the keys and values.
    >>
    >> So, I kind of like Florian Pflug's suggestion upthread of replacing
    >> hstore => text by hstore & text[].  I think that's about as mnemonic
    >> as we're likely to get, and it gels nicely with the hstore ?& text[]
    >> operator, which tests whether all of the named keys are present in the
    >> hstore.
    >>
    >> Does anyone want to bikeshed further before I go do that?
    >
    > Yeah. It actually doesn't make much sense to me. ?& is all about the keys and their presence, not the values. -> is a much better parallel, it being that it returns the keys in the rhs array. So I think something closer to it would be better.
    
    Well, the idea is it's like logical-and - give me only those keys that
    appear on both sides...
    
    > Some suggestions:
    >
    >  ~>
    >  <-
    >  #>
    >  +>
    >
    > Ooh, I like +>, as being: give me more than -> does.
    
    If there is a critical mass of votes for one of these options, I'm
    fine with whatever.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  55. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-16T02:55:24Z

    On Jun 15, 2010, at 6:58 PM, Robert Haas wrote:
    
    > Well, the idea is it's like logical-and - give me only those keys that
    > appear on both sides...
    
    Yeah, but => doesn't return the keys, -> does. => returns an hstore.
    
    > If there is a critical mass of votes for one of these options, I'm
    > fine with whatever.
    
    Put me down for +>.
    
    Best,
    
    David
    
    
    
    
  56. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-16T23:24:53Z

    On Tue, Jun 15, 2010 at 10:55 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 15, 2010, at 6:58 PM, Robert Haas wrote:
    >
    >> Well, the idea is it's like logical-and - give me only those keys that
    >> appear on both sides...
    >
    > Yeah, but => doesn't return the keys, -> does. => returns an hstore.
    >
    >> If there is a critical mass of votes for one of these options, I'm
    >> fine with whatever.
    >
    > Put me down for +>.
    
    Since there are no other votes for that option (or, indeed, any other
    option), I'm going to go with my original instinct and change hstore
    => text[] to hstore & text[].  Patch to do that is attached.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
  57. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-16T23:37:07Z

    On Jun 16, 2010, at 4:24 PM, Robert Haas wrote:
    
    >> Put me down for +>.
    > 
    > Since there are no other votes for that option (or, indeed, any other
    > option), I'm going to go with my original instinct and change hstore
    > => text[] to hstore & text[].  Patch to do that is attached.
    
    Damn. My other argument is that & looks like boolean or bitwise AND, so the return of an hstore might be unexpected. +> looks more like an arrow (sort of).
    
    But it doesn't much matter, as long as it works.
    
    Best,
    
    David
    
  58. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-16T23:53:19Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > Since there are no other votes for that option (or, indeed, any other
    > option), I'm going to go with my original instinct and change hstore
    > => text[] to hstore & text[].  Patch to do that is attached.
    
    Um ... wait a minute.  What happened to backwards compatibility?
    I thought the idea was to deprecate => for a release or so, not kill it
    on the spot.
    
    			regards, tom lane
    
    
  59. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-16T23:54:59Z

    On Jun 16, 2010, at 4:53 PM, Tom Lane wrote:
    
    > Um ... wait a minute.  What happened to backwards compatibility?
    > I thought the idea was to deprecate => for a release or so, not kill it
    > on the spot.
    
    hstore => text[] is new in 9.0.
    
    David
    
    
    
  60. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-16T23:58:22Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > On Jun 16, 2010, at 4:53 PM, Tom Lane wrote:
    >> Um ... wait a minute.  What happened to backwards compatibility?
    >> I thought the idea was to deprecate => for a release or so, not kill it
    >> on the spot.
    
    > hstore => text[] is new in 9.0.
    
    Wup, sorry, I read this as being the other operator.  Nevermind ...
    
    (FWIW, I share your dislike of & for this operator.  I just haven't
    got a better idea.)
    
    			regards, tom lane
    
    
  61. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-17T00:56:13Z

    On Jun 16, 2010, at 4:58 PM, Tom Lane wrote:
    
    >> hstore => text[] is new in 9.0.
    > 
    > Wup, sorry, I read this as being the other operator.  Nevermind ...
    > 
    > (FWIW, I share your dislike of & for this operator.  I just haven't
    > got a better idea.)
    
    There aren't any very good choices. Possible correlates:
    
      text[] key_slice := my_hstore -> ARRAY['foo', 'bar'];
    
      bool has_keys := my_hstore ?& ARRAY['foo', 'bar'];
    
      text[] keyvals := %% my_hstore;
    
      text[] keyvals := %# my_hstore;
    
    Frankly, %% and %# are closest, in a sense. But instead of an array, we want to get back an hstore. -> and ?& are correlates in that their RHSs are arrays.
    
    Possible operators to get a slice of the hstore:
    
      hstore slice := my_hstore +> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore #> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore &> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore !> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore *> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore %> ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore @ ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore % ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore # ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore & ARRAY['foo', 'bar'];
    
      hstore slice := my_hstore @# ARRAY['foo', 'bar'];
    
    Maybe %> is good, in that it combines %% and ->, in a sense. Or #>, which kind of goes along with #=, which also returns an hstore.
    
    Anyway, the more I look at it the less I care, as long as *something* works.
    
    Best,
    
    David
    
    
    
  62. Re: hstore ==> and deprecate =>

    Florian Pflug <fgp@phlo.org> — 2010-06-17T20:30:24Z

    On Jun 17, 2010, at 2:56 , David E. Wheeler wrote:
    > On Jun 16, 2010, at 4:58 PM, Tom Lane wrote:
    > 
    >>> hstore => text[] is new in 9.0.
    >> 
    >> Wup, sorry, I read this as being the other operator.  Nevermind ...
    >> 
    >> (FWIW, I share your dislike of & for this operator.  I just haven't
    >> got a better idea.)
    > 
    > There aren't any very good choices.
    
    Since there seems to be no consensus on this, maybe thats a sign that there shouldn't be an operator for this at all. I suggested & due due the similarities to ?&, but I can see why people object to that - mainly because it looks like an predicate, not like an operation on hstores.
    
    How about turning it into a function
        hstore hstore(hstore, text[])
    instead?
    
    Could also be hstore_restrict if people think naming it just hstore is ambiguous.
    
    best regards,
    Florian Pflug
    
    
    
  63. Re: hstore ==> and deprecate =>

    Josh Berkus <josh@agliodbs.com> — 2010-06-17T20:39:32Z

    > Since there are no other votes for that option (or, indeed, any other
    > option), I'm going to go with my original instinct and change hstore
    > => text[] to hstore & text[].  Patch to do that is attached.
    
    If what that operator is doing is appending an array of text to an
    Hstore, shouldn't we use || instead?
    
    
    -- 
                                      -- Josh Berkus
                                         PostgreSQL Experts Inc.
                                         http://www.pgexperts.com
    
    
  64. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-17T20:40:12Z

    On Thu, Jun 17, 2010 at 4:39 PM, Josh Berkus <josh@agliodbs.com> wrote:
    >
    >> Since there are no other votes for that option (or, indeed, any other
    >> option), I'm going to go with my original instinct and change hstore
    >> => text[] to hstore & text[].  Patch to do that is attached.
    >
    > If what that operator is doing is appending an array of text to an
    > Hstore, shouldn't we use || instead?
    
    It isn't.  || already does what you're saying.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  65. Re: hstore ==> and deprecate =>

    Josh Berkus <josh@agliodbs.com> — 2010-06-17T20:50:55Z

    On 6/17/10 1:40 PM, Robert Haas wrote:
    > On Thu, Jun 17, 2010 at 4:39 PM, Josh Berkus <josh@agliodbs.com> wrote:
    >>> Since there are no other votes for that option (or, indeed, any other
    >>> option), I'm going to go with my original instinct and change hstore
    >>> => text[] to hstore & text[].  Patch to do that is attached.
    >> If what that operator is doing is appending an array of text to an
    >> Hstore, shouldn't we use || instead?
    > 
    > It isn't.  || already does what you're saying.
    
    So what *does* it do?
    
    OK, so after a brief poll on IRC, one reason you're not getting coherent
    feedback on this is that few people understand the operators which
    hstore 9.0 already uses and which are new for 9.0, let alone what new
    operators are proposed for each thing.  I know I've completely lost
    track, particularly since doc patches haven't kept up with the code
    changes.  I've reread most of this thread and it doesn't help me.
    
    On the other hand, maybe less feedback is less bikeshedding.  You decide.
    
    -- 
                                      -- Josh Berkus
                                         PostgreSQL Experts Inc.
                                         http://www.pgexperts.com
    
    
  66. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-17T21:03:32Z

    On Jun 17, 2010, at 1:50 PM, Josh Berkus wrote:
    
    >> It isn't.  || already does what you're saying.
    > 
    > So what *does* it do?
    
    It returns an hstore that's effectively a slice of another hstore. From the docs (http://developer.postgresql.org/pgdocs/postgres/hstore.html):
    
    'a=>1,b=>2,c=>3'::hstore => ARRAY['b','c','x']
    
    Result is:
    
    '"b"=>"2", "c"=>"3"'::hstore
    
    Best,
    
    David
    
  67. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-17T21:26:38Z

    On Thu, Jun 17, 2010 at 4:50 PM, Josh Berkus <josh@agliodbs.com> wrote:
    > On 6/17/10 1:40 PM, Robert Haas wrote:
    >> On Thu, Jun 17, 2010 at 4:39 PM, Josh Berkus <josh@agliodbs.com> wrote:
    >>>> Since there are no other votes for that option (or, indeed, any other
    >>>> option), I'm going to go with my original instinct and change hstore
    >>>> => text[] to hstore & text[].  Patch to do that is attached.
    >>> If what that operator is doing is appending an array of text to an
    >>> Hstore, shouldn't we use || instead?
    >>
    >> It isn't.  || already does what you're saying.
    >
    > So what *does* it do?
    >
    > OK, so after a brief poll on IRC, one reason you're not getting coherent
    > feedback on this is that few people understand the operators which
    > hstore 9.0 already uses and which are new for 9.0, let alone what new
    > operators are proposed for each thing.  I know I've completely lost
    > track, particularly since doc patches haven't kept up with the code
    > changes.  I've reread most of this thread and it doesn't help me.
    >
    > On the other hand, maybe less feedback is less bikeshedding.  You decide.
    
    Well, they are documented, so you can read up on them...
    
    http://developer.postgresql.org/pgdocs/postgres/hstore.html
    
    This isn't a critical issue in desperate need of community input; we
    just need to resolve it one way or the other so we can move on to the
    next thing.  I'm still inclined to go ahead and apply the patch I
    attached upthread, because that is less work for me than doing
    anything else...
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  68. Re: hstore ==> and deprecate =>

    Josh Berkus <josh@agliodbs.com> — 2010-06-17T22:25:29Z

    On 6/17/10 2:03 PM, David E. Wheeler wrote:
    > On Jun 17, 2010, at 1:50 PM, Josh Berkus wrote:
    > 
    >>> It isn't.  || already does what you're saying.
    >> So what *does* it do?
    > 
    > It returns an hstore that's effectively a slice of another hstore. From the docs (http://developer.postgresql.org/pgdocs/postgres/hstore.html):
    
    OK, hammered this out on IRC with several Hstore users, and I think the
    best answer here is consistency.  Both with the other hstore operators
    and with other set types, such as intarray and ltree.
    
    Currently for hstore, %% returns a flattened array and %# returns a
    two-dimensional array.  That means that it makes sense that the operator
    which returns an hstore subset should be something based on %, either
    %>, %% or just %.
    
    I vote for % .
    
    Stuff we discussed and discarded includes:
    
    & for two reasons: (a) it looks like a predicate and (b) it's used as
    "intersect" for intarray and ltree, and we might want to implement
    intersect for hstore someday.
    
    # because it's used as "index" for intarray, and thus should more
    properly be a synonym for -> in hstore
    
    +> because it looks like it ought to be some kind of special incrementor.
    
    Using % would also mean that sometime in the future we can implement !%
    as "elements NOT in this list" (i.e. ' a => 1, b => 2, c => 5' !% 'a, b'
    == 'c => 5' )
    
    -- 
                                      -- Josh Berkus
                                         PostgreSQL Experts Inc.
                                         http://www.pgexperts.com
    
    
  69. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-17T23:15:10Z

    Josh Berkus <josh@agliodbs.com> writes:
    > Currently for hstore, %% returns a flattened array and %# returns a
    > two-dimensional array.  That means that it makes sense that the operator
    > which returns an hstore subset should be something based on %, either
    > %>, %% or just %.
    
    But %% and %# are prefix operators.  Extrapolating from those to an
    infix operator seems a bit thin.  Nonetheless, something using % seems
    better than something using &, for the other reasons you mention.
    
    > I vote for % .
    
    I'd vote for %>, out of those.  Reason: the operator isn't commutative,
    in fact left and right inputs aren't even the same datatype, so a glyph
    that looks asymmetric seems more natural.
    
    > Using % would also mean that sometime in the future we can implement !%
    > as "elements NOT in this list" (i.e. ' a => 1, b => 2, c => 5' !% 'a, b'
    > == 'c => 5' )
    
    You can prepend ! to any operator name at all, so that's not much of
    a differentiator.
    
    			regards, tom lane
    
    
  70. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-18T00:23:40Z

    On Jun 17, 2010, at 4:15 PM, Tom Lane wrote:
    
    >> Using % would also mean that sometime in the future we can implement !%
    >> as "elements NOT in this list" (i.e. ' a => 1, b => 2, c => 5' !% 'a, b'
    >> == 'c => 5' )
    > 
    > You can prepend ! to any operator name at all, so that's not much of
    > a differentiator.
    
    %!> then. :-)
    
    David
    
    
    
  71. Re: hstore ==> and deprecate =>

    Andrew Dunstan <andrew@dunslane.net> — 2010-06-18T03:04:45Z

    
    Tom Lane wrote:
    > Josh Berkus <josh@agliodbs.com> writes:
    >   
    >> Currently for hstore, %% returns a flattened array and %# returns a
    >> two-dimensional array.  That means that it makes sense that the operator
    >> which returns an hstore subset should be something based on %, either
    >> %>, %% or just %.
    >>     
    >
    > But %% and %# are prefix operators.  Extrapolating from those to an
    > infix operator seems a bit thin.  Nonetheless, something using % seems
    > better than something using &, for the other reasons you mention.
    >
    >   
    >> I vote for % .
    >>     
    >
    > I'd vote for %>, out of those.  Reason: the operator isn't commutative,
    > in fact left and right inputs aren't even the same datatype, so a glyph
    > that looks asymmetric seems more natural.
    >
    >   
    
    
    
    I think this bikeshed is going to be more paint than shed. However, I 
    just wondered about | as the operator. Think of the right hand operand 
    as a filter on the hstore, and a pipe seems to work.
    
    Lots of operators aren't commutative. Arithmetic % for example ;-)
    
    But honestly, I can live with just about anything.
    
    cheers
    
    andrew
    
    
    
  72. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-18T03:54:00Z

    On Thu, Jun 17, 2010 at 11:04 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
    >>> I vote for % .
    >> I'd vote for %>, out of those.  Reason: the operator isn't commutative,
    >> in fact left and right inputs aren't even the same datatype, so a glyph
    >> that looks asymmetric seems more natural.
    > Lots of operators aren't commutative. Arithmetic % for example ;-)
    
    I've committed this as % -- if anyone cares about it enough to keep
    arguing, we can change it again.
    
    > I think this bikeshed is going to be more paint than shed.
    
    You said it.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  73. Re: hstore ==> and deprecate =>

    Josh Berkus <josh@agliodbs.com> — 2010-06-18T17:03:38Z

    >> I vote for % .
    >
    > I'd vote for %>, out of those.  Reason: the operator isn't commutative,
    > in fact left and right inputs aren't even the same datatype, so a glyph
    > that looks asymmetric seems more natural.
    
    +1 on %>
    
    (Frankly, as long as it isn't & or | I can live with it ... )
    
    -- 
                                       -- Josh Berkus
                                          PostgreSQL Experts Inc.
                                          http://www.pgexperts.com
    
    
  74. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-18T17:26:49Z

    On Jun 18, 2010, at 10:03 AM, Josh Berkus wrote:
    
    >> I'd vote for %>, out of those.  Reason: the operator isn't commutative,
    >> in fact left and right inputs aren't even the same datatype, so a glyph
    >> that looks asymmetric seems more natural.
    > 
    > +1 on %>
    
    +1 from me, too.
    
    Best,
    
    David
    
    
  75. Re: hstore ==> and deprecate =>

    Greg Stark <gsstark@mit.edu> — 2010-06-18T18:20:26Z

    On Fri, Jun 18, 2010 at 6:26 PM, David E. Wheeler <david@kineticode.com> wrote:
    > +1 from me, too.
    >
    
    1 isn't a valid character in a postgres operator
    
    :P
    
    -- 
    greg
    
    
  76. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-18T18:27:06Z

    On Jun 18, 2010, at 11:20 AM, Greg Stark wrote:
    
    >> +1 from me, too.
    >> 
    > 
    > 1 isn't a valid character in a postgres operator
    
    Dammit!
    
    This reminds me, I wanted to ask one more thing:
    
    We don't have a slice operator for arrays; would we be happy with %> being such an operator in a future version? And, does the spec say anything about array operators?
    
    Best,
    
    David
    
  77. Re: hstore ==> and deprecate =>

    Greg Stark <gsstark@mit.edu> — 2010-06-18T21:35:16Z

    On Fri, Jun 18, 2010 at 7:27 PM, David E. Wheeler <david@kineticode.com> wrote:
    > We don't have a slice operator for arrays; would we be happy with %> being such an operator in a future version? And, does the spec say anything about array operators?
    >
    
    Personally, I don't find any of these proposals terribly intuitive.
    
    You know we don't really need an operator at all. slice(hash,
    array[1,2,3]) seems like not much typing overhead over hash %
    array[1,2,3] and clearer to boot. The only real advantage to having
    operators is for operators used to define opclasses. I can't see this
    ever being used in such a circumstance (but perhaps I'm not
    imaginative enough for GIST indexes these days) so unless there's a
    clear analogy to some basic operator that makes code clearer I would
    suggest it's not really buying us anything to define an operator name
    at all.
    
    -- 
    greg
    
    
  78. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-21T17:37:02Z

    On Jun 17, 2010, at 1:30 PM, Florian Pflug wrote:
    
    > How about turning it into a function
    >    hstore hstore(hstore, text[])
    > instead?
    
    I just searched through the 2008 spec for a slice/subset operator and came up empty. It seems to define a bunch of predicates for multisets, but not much for arrays.
    
    And looking again at the options, I'm *okay* with %, but not keen on %> anymore (I could see a future where %> and <% it as complement @> and <@ by confirming the presence of keys in an hstore:
    
        bool = hstore %> text[];
    
    So, frankly, I'm coming back to what Florian has suggested here. What about calling it slice?
    
        hstore = slice(hstore, text[]);
    
    It'd be nice to have one for arrays, too:
    
        anyarray[] = slice(anyarray[], int[]);
    
    An operator could always be added later if a good one appeared.
    
    Okay, no more bikeshedding for me on this issue. I'm covered in paint.
    
    Best,
    
    David
    
  79. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-06-21T17:46:31Z

    On Mon, Jun 21, 2010 at 1:37 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 17, 2010, at 1:30 PM, Florian Pflug wrote:
    >
    >> How about turning it into a function
    >>    hstore hstore(hstore, text[])
    >> instead?
    >
    > I just searched through the 2008 spec for a slice/subset operator and came up empty. It seems to define a bunch of predicates for multisets, but not much for arrays.
    >
    > And looking again at the options, I'm *okay* with %, but not keen on %> anymore (I could see a future where %> and <% it as complement @> and <@ by confirming the presence of keys in an hstore:
    >
    >    bool = hstore %> text[];
    >
    > So, frankly, I'm coming back to what Florian has suggested here. What about calling it slice?
    >
    >    hstore = slice(hstore, text[]);
    >
    > It'd be nice to have one for arrays, too:
    >
    >    anyarray[] = slice(anyarray[], int[]);
    >
    > An operator could always be added later if a good one appeared.
    >
    > Okay, no more bikeshedding for me on this issue. I'm covered in paint.
    
    I don't much like hstore(hstore, text[]) because it's not strictly a
    constructor.  But I could certainly live with something based on the
    word slice.  The existing SQL function backing the operator is called
    slice_hstore(), whereas I would probably prefer hstore_slice() or just
    slice(), but I can't talk about it right now because I have to go
    finish laundering the paint out of my entire wardrobe.  Having already
    written three patches to rename this operator (to three different
    names), I'm in no hurry to write a fourth unless the degree of
    consensus is sufficient to convince me I shan't need to write a fifth
    one.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  80. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-21T17:49:57Z

    "David E. Wheeler" <david@kineticode.com> writes:
    > So, frankly, I'm coming back to what Florian has suggested here. What about calling it slice?
    
    >     hstore = slice(hstore, text[]);
    
    +1, particularly seeing that our solution for the other two cases also
    comes down to "use the function instead".
    
    			regards, tom lane
    
    
  81. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-06-21T17:53:44Z

    On Jun 21, 2010, at 10:46 AM, Robert Haas wrote:
    
    > I don't much like hstore(hstore, text[]) because it's not strictly a
    > constructor.  But I could certainly live with something based on the
    > word slice.  The existing SQL function backing the operator is called
    > slice_hstore(), whereas I would probably prefer hstore_slice() or just
    > slice(), but I can't talk about it right now because I have to go
    > finish laundering the paint out of my entire wardrobe.  Having already
    > written three patches to rename this operator (to three different
    > names), I'm in no hurry to write a fourth unless the degree of
    > consensus is sufficient to convince me I shan't need to write a fifth
    > one.
    
    That seems wise. :-)
    
    Best,
    
    David
    
    
    
  82. Re: hstore ==> and deprecate =>

    Josh Berkus <josh@agliodbs.com> — 2010-06-28T18:47:36Z

    All,
    
    >> I don't much like hstore(hstore, text[]) because it's not strictly a
    >> constructor.  But I could certainly live with something based on the
    >> word slice.  The existing SQL function backing the operator is called
    >> slice_hstore(), whereas I would probably prefer hstore_slice() or just
    >> slice(), but I can't talk about it right now because I have to go
    >> finish laundering the paint out of my entire wardrobe.  Having already
    >> written three patches to rename this operator (to three different
    >> names), I'm in no hurry to write a fourth unless the degree of
    >> consensus is sufficient to convince me I shan't need to write a fifth
    >> one.
    
    While I would personally prefer to have an operator for the slicing
    opeeration, I'm not willing to spend time arguing about it.  So, +1 to
    implement the subset operation as the function slice(), and defer having
    an operator until later.
    
    In some ways, it makes more sense to talk about additional operators in
    the context of also adding them to intarray, and I don't want to go
    there yet.
    
    -- 
                                      -- Josh Berkus
                                         PostgreSQL Experts Inc.
                                         http://www.pgexperts.com
    
    
  83. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-06-28T19:10:13Z

    Josh Berkus <josh@agliodbs.com> writes:
    > While I would personally prefer to have an operator for the slicing
    > opeeration, I'm not willing to spend time arguing about it.  So, +1 to
    > implement the subset operation as the function slice(), and defer having
    > an operator until later.
    
    Yeah, I think the consensus is to avoid picking an operator name at all.
    "slice()" is OK by me.
    
    			regards, tom lane
    
    
  84. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-07-02T16:36:10Z

    On Jun 28, 2010, at 12:10 PM, Tom Lane wrote:
    
    >> While I would personally prefer to have an operator for the slicing
    >> opeeration, I'm not willing to spend time arguing about it.  So, +1 to
    >> implement the subset operation as the function slice(), and defer having
    >> an operator until later.
    > 
    > Yeah, I think the consensus is to avoid picking an operator name at all.
    > "slice()" is OK by me.
    
    Will this be done for Beta 3?
    
    Best,
    
    David
    
    
    
  85. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-07-02T17:07:21Z

    On Fri, Jul 2, 2010 at 12:36 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jun 28, 2010, at 12:10 PM, Tom Lane wrote:
    >
    >>> While I would personally prefer to have an operator for the slicing
    >>> opeeration, I'm not willing to spend time arguing about it.  So, +1 to
    >>> implement the subset operation as the function slice(), and defer having
    >>> an operator until later.
    >>
    >> Yeah, I think the consensus is to avoid picking an operator name at all.
    >> "slice()" is OK by me.
    >
    > Will this be done for Beta 3?
    
    You forgot to attach the patch.  :-)
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  86. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-07-02T18:39:23Z

    On Jul 2, 2010, at 10:07 AM, Robert Haas wrote:
    
    >>> Yeah, I think the consensus is to avoid picking an operator name at all.
    >>> "slice()" is OK by me.
    >> 
    >> Will this be done for Beta 3?
    > 
    > You forgot to attach the patch.  :-)
    
    Attached.
    
    Only thing that gave me pause is the presence of the undocumented `slice_array()` function, which is used by the `->` operator. I think I might like to see it renamed `avals(hstore, text[])` if it ever gets documented, as it nicely complements the existing `avals(hstore)` function.
    
    Best,
    
    David
    
    
    
  87. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-07-02T20:38:06Z

    On Fri, Jul 2, 2010 at 2:39 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jul 2, 2010, at 10:07 AM, Robert Haas wrote:
    >
    >>>> Yeah, I think the consensus is to avoid picking an operator name at all.
    >>>> "slice()" is OK by me.
    >>>
    >>> Will this be done for Beta 3?
    >>
    >> You forgot to attach the patch.  :-)
    >
    > Attached.
    >
    > Only thing that gave me pause is the presence of the undocumented `slice_array()` function, which is used by the `->` operator. I think I might like to see it renamed `avals(hstore, text[])` if it ever gets documented, as it nicely complements the existing `avals(hstore)` function.
    
    Thanks, committed - with the exception that I reverted your change to
    the title of section F.13.2, which I believe was in error (and
    possibly accidental).
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  88. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-07-02T20:43:26Z

    On Jul 2, 2010, at 1:38 PM, Robert Haas wrote:
    
    > Thanks, committed - with the exception that I reverted your change to
    > the title of section F.13.2, which I believe was in error (and
    > possibly accidental).
    
    No, I removed that because that table has only operators, no functions. See http://developer.postgresql.org/docs/postgres/hstore.html.
    
    Best,
    
    David
    
  89. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-07-02T20:45:44Z

    On Fri, Jul 2, 2010 at 4:43 PM, David E. Wheeler <david@kineticode.com> wrote:
    > On Jul 2, 2010, at 1:38 PM, Robert Haas wrote:
    >
    >> Thanks, committed - with the exception that I reverted your change to
    >> the title of section F.13.2, which I believe was in error (and
    >> possibly accidental).
    >
    > No, I removed that because that table has only operators, no functions. See http://developer.postgresql.org/docs/postgres/hstore.html.
    
    The section contains two tables.  Table F-5 is called "hstore
    operators", and table F-6 is called "hstore functions", and those two
    tables together make up a section called "F.13.2 hstore operators and
    functions".
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  90. Re: hstore ==> and deprecate =>

    David E. Wheeler <david@kineticode.com> — 2010-07-02T20:48:42Z

    On Jul 2, 2010, at 1:45 PM, Robert Haas wrote:
    
    >> No, I removed that because that table has only operators, no functions. Seehttp://developer.postgresql.org/docs/postgres/hstore.html.
    > 
    > The section contains two tables.  Table F-5 is called "hstore
    > operators", and table F-6 is called "hstore functions", and those two
    > tables together make up a section called "F.13.2 hstore operators and
    > functions".
    
    Oh. Duh.
    
    David
    
  91. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-07-02T21:00:26Z

    "David E. Wheeler" <david@kineticode.com> writes:
    >> You forgot to attach the patch.  :-)
    
    > Attached.
    
    Okay, I'm confused.  This patch removed an operator named %, which AFAIK
    was not controversial.  The problematic operator is => no?
    
    			regards, tom lane
    
    
  92. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-07-02T21:02:18Z

    On Fri, Jul 2, 2010 at 5:00 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > "David E. Wheeler" <david@kineticode.com> writes:
    >>> You forgot to attach the patch.  :-)
    >
    >> Attached.
    >
    > Okay, I'm confused.  This patch removed an operator named %, which AFAIK
    > was not controversial.  The problematic operator is => no?
    
    It used to be =>
    
    After much bikeshedding, we renamed it to %
    
    After more bikeshedding, we decided to remove it altogether, hence the
    present patch.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company
    
    
  93. Re: hstore ==> and deprecate =>

    Tom Lane <tgl@sss.pgh.pa.us> — 2010-07-02T21:03:19Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > On Fri, Jul 2, 2010 at 5:00 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    >> Okay, I'm confused. This patch removed an operator named %, which AFAIK
    >> was not controversial. The problematic operator is => no?
    
    > It used to be =>
    
    Nevermind, I *am* confused.  Obviously time to knock off for the day;
    my brain's fried.
    
    			regards, tom lane
    
    
  94. Re: hstore ==> and deprecate =>

    Robert Haas <robertmhaas@gmail.com> — 2010-07-02T21:08:46Z

    On Fri, Jul 2, 2010 at 5:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    > Robert Haas <robertmhaas@gmail.com> writes:
    >> On Fri, Jul 2, 2010 at 5:00 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
    >>> Okay, I'm confused.  This patch removed an operator named %, which AFAIK
    >>> was not controversial.  The problematic operator is => no?
    >
    >> It used to be =>
    >
    > Nevermind, I *am* confused.  Obviously time to knock off for the day;
    > my brain's fried.
    
    Just as long as you don't ask to have it changed again.  :-)
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise Postgres Company