Skip to content

Please support JSON / Object('json') type - at least [bulk] inserts #308

Closed

Description

@v-instrumentix

Dear all,
my app (c++) needs to populate JSON column.
Is there a plan to add support for it?

I made attempt to add JSON following implementation for String type (https://github.com/v-instrumentix/clickhouse-cpp.git - sorry if you find it nasty), but ended with server error

DB::Exception: Syntax error (data type): failed at position 1 ('{'): {"a":false, "b":true, "c":0, "d":1, "e":"Hello", "d":"", "z":null}. Expected one of: data type, nested table, identifier.

..that looks as I miss something about the protocol / encoding, and this is where I stuck.
Any hints would be welcome.

Thanks!

Activity

  1. Enmk commented on Jun 5, 2023

    @Enmk
    Contributor

    Hi @v-instrumentix ! Well, there were no plans to support Json type, but any contribution is more than welcome. Please do not forget to update tests as well (I haven't found any in your repo)

  2. v-instrumentix commented on Jun 5, 2023

    @v-instrumentix
    Author

    Dear @Enmk , thanks for returning back to me.
    I would be happy to contribute, but I miss knowledge of client-server protocol and encoding, so I failed with adding support for JSON in my previous attempt.
    If you could point me to appropriate docs, I'll give it another try.
    Cheers!

  3. Enmk commented on Jun 7, 2023

    @Enmk
    Contributor

    There are not much docs on native client-server protocol, you'd have to read source of ClickHouse in order to understand how the data is transferred:

  4. v-val commented on Jun 7, 2023

    @v-val

    @Enmk right, I tried to follow the code and made some progress this way but then stuck with the error above; hoped there're some docs that might help.

    FYI, I was able to sort the functional side of problem via plain text bulk insert statements:

    INSERT INTO `table` FORMAT TabSeparated
    ...
    

    Thanks a lot for the hints anyway, I'll use them if / when I have a chance to proceed with this.

  5. slabko commented on Jul 9, 2026

    @slabko
    Contributor

    JSON is no supported in version 2.6.2 using output_format_native_write_json_as_string. Please see more in the PR description Experimental support for the JSON data type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpg_clickhouseNeeded by the pg_clickhouse PostgreSQL FDW

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions