Skip to content

Securely Formatting JSONB Column Names #877

Answered by vitaly-t
akumareog asked this question in Q&A
Discussion options

You must be logged in to vote

There is no special provision for jsonb in this library.

A little modified code than what you are using:

format('${column.0:name}#>>${pathArray}', {
  column: namePath,
  pathArray: `{${namePath.slice(1).join(',')}}`,
});

i.e. you can use nested variable names, including indexes, and there's no point using :csv filter when you pass in just one pre-formatted string.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@akumareog
Comment options

@vitaly-t
Comment options

@akumareog
Comment options

Answer selected by akumareog
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