Skip to content

Instantly share code, notes, and snippets.

@bassemawhoob
Created January 17, 2024 14:12
Show Gist options
  • Save bassemawhoob/115823fe651799342ddfed28b48cd917 to your computer and use it in GitHub Desktop.
Save bassemawhoob/115823fe651799342ddfed28b48cd917 to your computer and use it in GitHub Desktop.
Set a dynamically nested jsonb key by key type
UPDATE visual_settings
SET calendar = jsonb_set(cast(calendar as jsonb), '$.**.firstDay', '"new_value"', false)
WHERE json_typeof(jsonb_path_query_first(calendar, '$.**.firstDay')::json) = 'string'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment