json_type insert option is parsed but has no effect in 13.7.2.1

Open
#2,172 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
haskell, postgresql
Domain
backend, databases

Research direction

Start with doc/configuration.md and JsonTypeConfig in cardano-db-sync/src/Cardano/DbSync/Config/Types.hs, then read the config-parse tests and generator references. Trace whether schema, migration, insert, or query modules consume the option; done means either wiring text/jsonb/disable into JSON column storage or removing the inert setting and documenting the replacement.

Written by the indexing model from the issue text.

Description

question

Question

doc/configuration.md shows json_type in the insert_options examples (e.g. "json_type": "text"), but setting it appears to do nothing. Is it still a supported option, or is it dead config that should be wired up or removed/documented?

Observed

db-sync 13.7.2.1 (git db8cdf6), preview and a local testnet. Recreated the database from scratch under each setting:

  • json_type: text -> the .json columns are jsonb
  • json_type: jsonb -> the .json columns are jsonb

The text and jsonb settings produce an identical schema. Columns checked:
tx_metadata.json, script.json, off_chain_pool_data.json, off_chain_vote_data.json (all stay jsonb, which is also the default).

Source

sioJsonType / JsonTypeConfig is defined and parsed in cardano-db-sync/src/Cardano/DbSync/Config/Types.hs (accepted values text, jsonb, disable; default JsonTypeText).

Grepping the tree, the only references to JsonType / sioJsonType are in that file plus the config-parse tests and a generator - there is no reference in any Schema, Migration, Insert or Query module.

So the value is validated and round-tripped in the config but never consumed, which matches the "no effect" behaviour above.

Resolution

Either:

  1. Wire json_type into the schema so text / jsonb / disable actually control the storage type of the JSON columns, or
  2. If it is intentionally inert (superseded by remove_jsonb_from_schema), document that and/or remove it from the config and the examples so users do not set an option that does nothing.
Dominant language
Haskell
Stars
319
Forks
169
Avg merge
10h 54m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntersectMBO/cardano-db-sync

All issues in IntersectMBO/cardano-db-sync

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.