{"id":20673721,"url":"https://github.com/cpg314/pg_ch_format","last_synced_at":"2026-05-15T18:32:58.440Z","repository":{"id":237557476,"uuid":"794704563","full_name":"cpg314/pg_ch_format","owner":"cpg314","description":"Format Postgres or Clickhouse SQL files.","archived":false,"fork":false,"pushed_at":"2024-06-02T19:48:53.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T09:36:01.493Z","etag":null,"topics":["clickhouse","formatter","postgres","rust"],"latest_commit_sha":null,"homepage":"https://c.pgdm.ch/code","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpg314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-01T19:22:44.000Z","updated_at":"2025-05-16T22:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd8a8259-675a-4b32-8c26-4cf753ad7edc","html_url":"https://github.com/cpg314/pg_ch_format","commit_stats":null,"previous_names":["cpg314/pg_ch_format"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cpg314/pg_ch_format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpg_ch_format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpg_ch_format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpg_ch_format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpg_ch_format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpg314","download_url":"https://codeload.github.com/cpg314/pg_ch_format/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpg314%2Fpg_ch_format/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33074840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","formatter","postgres","rust"],"created_at":"2024-11-16T20:42:20.913Z","updated_at":"2026-05-15T18:32:58.409Z","avatar_url":"https://github.com/cpg314.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_ch_format\n\nThe goals of that small tool are to:\n\n- Allow running [`pg_format`](https://github.com/darold/pgFormatter/) or [`clickhouse-format`](https://clickhouse.com/docs/en/operations/utilites/clickhouse-format) on SQL files, detecting the dialect (Postgres or Clickhouse) automatically or through file extensions or annotations.\n- Add a check mode to both, to verify in CI that files are properly formatted. See [this github issue](https://github.com/darold/pgFormatter/issues/137).\n\n## Usage\n\n```\nFormat Postgres or Clickhouse SQL files.\n\nOUTPUT FORMAT\nIf the input is stdin (`-`), the formatted contents will be output on stdout.\nOtherwise, a diff for the misformatted files is shown.\n\nEXIT CODES\n0: Success\n1: Program error\n2: Unformatted files\n\nUsage: pg_ch_format [OPTIONS] \u003cINPUT\u003e\n\nArguments:\n  \u003cINPUT\u003e\n          Folder, filename, or `-` to read from stdin\n\nOptions:\n  -i, --inplace\n          Rewrite the formatted files..\n\n  -h, --help\n          Print help (see a summary with '-h')\n\n  -V, --version\n          Print version\n```\n\n## Dialect detection\n\nThis is for now very primitive. You can also specify the dialect manually with\n\n```sql\n-- dialect=Clickhouse\n-- or\n-- dialect=Postgres\n```\n\nin your SQL file.\n\n## Known issues\n\n- A bug in `clickhouse-format` removes some inline comments (https://github.com/ClickHouse/ClickHouse/issues/62256)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fpg_ch_format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpg314%2Fpg_ch_format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpg314%2Fpg_ch_format/lists"}