Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Add messagepack return type #696

Open
saolof opened this issue May 17, 2023 · 6 comments
Open

Add messagepack return type #696

saolof opened this issue May 17, 2023 · 6 comments
Labels
how-tos Goal oriented guides. Not in depth.

Comments

@saolof
Copy link

saolof commented May 17, 2023

Messagepack is a json-isomorphic binary serialization format that is becoming fairly widely supported and which supports fast streaming serialization/deserialization. It would be neat to have it as a return format. Both in JSON like form, and in a header + stream of tuples form for returning large numerical data sets like timeseries.

@steve-chavez
Copy link
Member

msgpack was discussed here before: PostgREST/postgrest#1548

PostgREST/postgrest#1582 is still looking like the way forward

@wolfgangwalther
Copy link
Member

Even with better content negotiation, we'd still need a way to convert to and from msgpack. Is there a postgres extension to do it?

@steve-chavez
Copy link
Member

@wolfgangwalther
Copy link
Member

Yes, there's https://github.com/patriksimek/msgpack-postgres

Right, I'm just not sure whether an implementation written in plpgsql will be helpful in terms of performance... which seems to be the primary use-case for to request msgpack data in the first place.

@wolfgangwalther
Copy link
Member

Is this now possible from PostgREST-side? I think it is, right? @steve-chavez

@steve-chavez
Copy link
Member

Yeah, should be possible like:

create domain "application/x-msgpack" as bytea;

create or replace function hello() returns "application/x-msgpack" as $$
  select msgpack_encode('{"hello": "world"}'::jsonb);
$$ language sql;

Using the extension https://github.com/patriksimek/msgpack-postgres.

@steve-chavez steve-chavez transferred this issue from PostgREST/postgrest Nov 13, 2023
@steve-chavez steve-chavez added the how-tos Goal oriented guides. Not in depth. label Nov 13, 2023
@steve-chavez steve-chavez reopened this Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
how-tos Goal oriented guides. Not in depth.
Development

No branches or pull requests

3 participants