You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use this query(you could run it by replacing $1 with your schema) to get the defaults, it's based on information_schema.columns, and you're right in that these don't always come properly formatted:
decode returns Nothing on failure, so we would have to clean column_default first to make it work for all types.
If you'd like to do a PR, an option would be to parse this in decodeColumns(similarly to how we do it in decodeProcs).
Another option would be to do it at the query level, you could use pg string functions, like regexp_split_to_array(to ignore chars after ::) or regexp_replace(to remove single quotes).
Thanks for the explanation and the references. It doesn't affect my current work directly, so I'm not sure when/if I will have time to look into this and submit a PR.
Environment
Description of issue
Here's an example table:
And the produced OpenAPI specification (only
definitions.defaults.properties
):As you can see only default values for the numeric columns were preserved. Te responsible code is here:
postgrest/src/PostgREST/OpenAPI.hs
Line 67 in fa1e92f
I'm not sure, but I think that
decode
fails on strings because they are not quoted (or quoted with single quotes?).The text was updated successfully, but these errors were encountered: