pgadapter icon indicating copy to clipboard operation
pgadapter copied to clipboard

feature request: add supoprt for hstore

Open redbaron opened this issue 2 years ago • 3 comments

It would be nice if hstore type was supported on PG protocol side. Possibly it could be translated into jsonb on spanner.

redbaron avatar Nov 02 '23 11:11 redbaron

@redbaron Thanks for your request. Is there a specific reason that you would like this to be supported? Is there a specific tool or driver that requires this, or is there some other reason?

olavloite avatar Nov 02 '23 18:11 olavloite

If hstore was supported, it would be almost a drop in replacement for the PostgreSQL app we have

redbaron avatar Nov 02 '23 21:11 redbaron

If hstore was supported, it would be almost a drop in replacement for the PostgreSQL app we have

Could you elaborate a bit more on what support you would need? The reason that I'm asking is that:

  1. hstore is defined in an extension, which means that it does not have a fixed oid. We could add it to the pg_type table that PGAdapter uses with a randomly chosen (but fixed) oid. That would enable tools/applications that read pg_type to check whether hstore exists to work, and also allow them to send data to PGAdapter that it claims is of type hstore.
  2. We could map those values of type hstore to text in PGAdapter. jsonb is not an option, as hstore uses a different format than jsonb, and I would expect an application that thinks that it is using hstore to use the hstore format.
  3. There's no way for PGAdapter to detect that text data that is returned by Cloud Spanner should be returned as if it was hstore. So I'm not sure that the client/application in this case would be able to handle that.

There would be no support for any of the hstore functions or operators. So something like SELECT h['a'] FROM mytable; would not work.

olavloite avatar Nov 03 '23 15:11 olavloite