IntersectMBO / IntersectMBO/cardano-db-sync

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
question
Dominant language
Haskell
Stars
318
Forks
168
PR merge metrics
No merged PRs in 30d

Description

## 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.

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.