Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

missmatches in return types of response lib functions #19

Open
oakgary opened this issue Aug 18, 2020 · 1 comment
Open

missmatches in return types of response lib functions #19

oakgary opened this issue Aug 18, 2020 · 1 comment

Comments

@oakgary
Copy link

oakgary commented Aug 18, 2020

Trying to add the response lib to my environment I run into the following error:

│2020-08-18 09:17:06.958 UTC [71] ERROR:  return type mismatch in function declared to return void                                                     │
│2020-08-18 09:17:06.958 UTC [71] DETAIL:  Actual return type is text.                                                                                 │
│2020-08-18 09:17:06.958 UTC [71] CONTEXT:  SQL function "set_header"                                                                                  │
│2020-08-18 09:17:06.958 UTC [71] STATEMENT:  create or replace function response.set_header(name text, value text) returns void as $$                 │
│        select set_config(                                                                                                                            │
│            'response.headers',                                                                                                                       │
│            jsonb_insert(                                                                                                                             │
│                (case coalesce(current_setting('response.headers',true),'')                                                                           │
│                when '' then '[]'                                                                                                                     │
│                else current_setting('response.headers')                                                                                              │
│                end)::jsonb,                                                                                                                          │
│                '{0}'::text[],                                                                                                                        │
│                jsonb_build_object(name, value))::text,                                                                                               │
│            true                                                                                                                                      │
│        );                                                                                                                                            │
│    $$ stable language sql;                                                                                                                           │
│psql:/docker-entrypoint-initdb.d/libs/response/schema.sql:35: ERROR:  return type mismatch in function declared to return void                        │
│DETAIL:  Actual return type is text.                                                                                                                  │
│CONTEXT:  SQL function "set_header" 

I assume that is because the return type of the set_config function is actually text.
What do you think could be the cause for me running into this problem?

€: same problem with the set_cookie and delete_cookie function

@oakgary oakgary changed the title set_header function of response lib missmatch in return type missmatches in return types of response lib functions Aug 18, 2020
@oakgary
Copy link
Author

oakgary commented Aug 18, 2020

as discussed with @ruslantalpa in slack it is probably the postgres version; note: we did not verify this
i am using 10.9, while the starter-kit uses 11.x which seems to have become less strict

changing the return type of the three mentioned functions to text fixes the errors

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant