Skip to content

Resource embedding on procedure #1709

Answered by u8sand
u8sand asked this question in Q&A
Dec 28, 2020 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Edit: See comments for full answer

Update

I played around with this a bit and made some meaningful progress by doing the following (as weird as I felt it was when I tried it).

I created a "placeholder" view to effectively represent the structure I hoped to return so that I can still use setof notation to describe the results:

create or replace view api.query_results as
select *, '' as reason
from api.path;

Un-intuitively, this did allow me to change the reason from an empty string to the reason I wanted:

create or replace function api.query(q text, lim int)
returns setof api.query_results
as $$
  select
    -- all fields in api.path
    api.query_results.path,
    api.query_results.type,
…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@wolfgangwalther
Comment options

@u8sand
Comment options

@wolfgangwalther
Comment options

@wolfgangwalther
Comment options

@u8sand
Comment options

Answer selected by u8sand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants