{"id":15211059,"url":"https://github.com/ashenblade/postgres-dev-helper","last_synced_at":"2025-10-29T16:31:09.589Z","repository":{"id":250003726,"uuid":"833117118","full_name":"ashenBlade/postgres-dev-helper","owner":"ashenBlade","description":"VS Code extension to assist PostgreSQL source code developers","archived":false,"fork":false,"pushed_at":"2025-01-22T15:50:24.000Z","size":24553,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T03:13:54.995Z","etag":null,"topics":["debugging","postgres","postgresql","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashenBlade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-07-24T11:42:05.000Z","updated_at":"2025-01-22T15:50:13.000Z","dependencies_parsed_at":"2024-09-07T18:26:37.390Z","dependency_job_id":"1c03365d-a68c-40f9-823f-31a5c40b5aef","html_url":"https://github.com/ashenBlade/postgres-dev-helper","commit_stats":{"total_commits":101,"total_committers":3,"mean_commits":"33.666666666666664","dds":0.4653465346534653,"last_synced_commit":"f7a1b563c1530de11413ef9e2fbe9d93ef678c59"},"previous_names":["ashenblade/postgres-dev-helper"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashenBlade%2Fpostgres-dev-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashenBlade%2Fpostgres-dev-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashenBlade%2Fpostgres-dev-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashenBlade%2Fpostgres-dev-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashenBlade","download_url":"https://codeload.github.com/ashenBlade/postgres-dev-helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238848469,"owners_count":19540891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["debugging","postgres","postgresql","vscode-extension"],"created_at":"2024-09-28T08:02:05.187Z","updated_at":"2025-10-29T16:31:09.583Z","avatar_url":"https://github.com/ashenBlade.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSQL Hacker Helper\n\n![Logo](./img/logo.png)\n\nThis is a Visual Studio Code extension to assist PostgreSQL source code developers:\n\n- Exploring Postgres variables (`Node *`, `HTAB *`, `List *`, `Bitmapset *`, etc...)\n- Code formatting using `pgindent`\n- Syntax and completion support for `postgresql.conf`\n- Extension bootstrapping\n\n## Features\n\n### Postgres Variables\n\nExtension provides assistance with postgres variables:\n\n- View `Node *` variables with real type according to `NodeTag`\n- Get the contents of container types: `List *`, `HTAB *`, `Bitmapset *`\n- Render `Expr` nodes by the original expression\n- Show integer enums as enum values, not integers\n\nExtension creates separate view in debug section - `PG Variables`. It contains postgres variables - extended with knowledge of source code.\n\n![Overview of extension](./img/overview.gif)\n\n- `Node *` variables casted to types according to `NodeTag`\n- Container types show their elements:\n  - `List *` (with support for scalars)\n  - `HTAB *`\n  - simplehash (`lib/simplehash.h`)\n  - `Bitmapset *`\n- Render `Expr` nodes by the original expression\n- `Bitmapset *` elements (numbers) store references to which they point, i.e. `Relids` will store `RelOptInfo` and `RangeTable` references\n- `List *` can support custom pointer types (not `Node *` types)\n- Some types are rendered in more convenient way, i.e.:\n  - `XLogRecPtr` - `File/Offset`\n  - `RelFileLocator` - `spc/db/file`\n  - `RangeTblEntry` - `alias` or `eref` value\n  - `NameData` - string value directly\n- Enum values, which defined using preprocessor (`#define`) are shown as enum values, not integers.\n\n### Formatting\n\nExtension uses `pgindent` for formatting C code. It integrates with VS Code extension and available with `Format Document` or `Ctrl + Shift + I` shortcut (or another key binding if overridden). Or you can just specify formatter manually using `Format Document With...` - select `PostgreSQL Hacker Helper` in pick up box.\n\n![Formatter work](./img/formatter-work.gif)\n\nFeature supported for PostgreSQL starting from 10 version.\n\n\u003e This feature using tools from `src/tools`. If they are unavailable extension will try to build or download them.\n\u003e\n\u003e Primary tool required is `pg_bsd_indent` - extension will try to build it.\n\u003e For this `pg_config` is used, but if extension fails to find it you will be prompted to enter path to it.\n\nUsing command `PGHH: Show diff preview for PostgreSQL formatter` you can\npreview changes made by formatter.\n\nAlso, you can add your custom `typedefs.list` files and extension will use it during formatting (`\"typedefs\"`). For more info check [documentation](docs/configuration.md#custom-typedefslist).\n\n### Dump `Node *`\n\nIn PostgreSQL there is `pprint(Node *)` which dumps passed Node variable to\nstdout with pretty printing it. Using 'Dump Node to log' option in variable\ncontext menu you also will be able to do so.\n\n![call pprint](img/dump.gif)\n\nAlso, you can dump `Node *` into newly created document and work with it as text file.\nThere is `Dump Node to document` option in variable context menu.\n\n### Extension bootstrapping\n\nExtension can help with creation of basic PostgreSQL extension files: Makefile, control file, source files (C, SQL) and tests.\n\nJust run command `Bootstrap extension` and enter initial values (extension name, description, required files). Extension will be created inside `contrib` directory.\n\n### `postgresql.conf` syntax support\n\nPostgreSQL configuration files `postgresql.conf` and `postgresql.auto.conf` have syntax support.\nAlso, for there is autocompletion for configuration parameters also with default contrib's GUCs.\n\n![Syntax example](./img/pgconf_syntax.png)\n\nThis syntax must be enabled for `postgresql[.auto].conf` files, but you can specify it using 'Change Language Mode' -\u003e 'PostgreSQL configuration'\n\n## Configuration\n\nExtension has configuration file - `.vscode/pgsql_hacker_helper.json`.\nMain purpose is to allow to define container elements custom types, i.e. when you are developing a contrib.\n\nIt allows adding information about:\n\n- Custom array types (with dynamic length evaluation using provided expressions)\n- Pointer types in `List *`, which are not Node-derived\n- HashTable entry types for both `HTAB` and `simplehash`\n- Custom `typedefs.list` files for formatter\n\nAlso there is VS Code settings with generic behavior customization.\n\nFor more info check [configuration file documentation](./docs/configuration.md).\n\n## Documentation\n\nDocumentation is available locally in [`docs` directory](./docs/).\n\nAlso, there is [Read the docs](https://ashenBlade.github.io/postgres-dev-helper) site with:\n\n- PostgreSQL and VS Code setup\n- Useful development scripts\n- Configuration file usage example\n- Usage examples, i.e. contrib development example\n\n## Compatibility\n\nCompatibility is ensured using testing. Minimal supported versions are **PostgreSQL 9.6** and **VS Code 1.70**.\n\nThere are 2 supported debugger extensions:\n\n- [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) from **1.12**\n- [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) from **11.0**\n\nExtension always tested on *latest version of debugger* and do not tries to be compatible with old ones due to *possible* large/breaking changes in behavior (most features implemented using hacks).\n\nFor using formatter minimal supported version Postgres is `10`.\n\n## Testing\n\nDirectory [`./src/test`](./src/test) contains multiple staff for extension testing.\nYou can read [README](./src/test/README.md) to look at testing process.\n\nFor variables testing is performed using matrix: PG Version x VS Code Version x Debugger.\nEach dimension contains all supported values: 9 (PG Versions) x 4 (VS Code Versions) x 2 (Debuggers) = 72 tests in total.\n\nFor formatting testing is performed using matrix: PG Version x VS Code Version (36 tests in total).\n\n## Known Issues\n\nKnown issues:\n\n- If in pointer variable was garbage, extension will not detect it and expand this variable (may be garbage).\n  Usually, this will not lead to fatal errors, just note this.\n- To get `NodeTag`s extension reads all available NodeTag files (from settings),\n  but these files may be not created (./configure or make not run). I assume by\n  time of debugging start files will be created, so extension catch them and process.\n- Sometimes formatting can misbehave. This is due to `pg_bsd_indent` internal\n  logic. If formatting is not applied check logs of an extension - it may contain\n  error messages.\n- Some operations require data to be allocated (usually, for function invocation).\n  For this, `palloc` and `pfree` are used. So if you are debugging memory subsystem\n  you may want to disable extension, because it may affect debugging process.\n- Some operations require for some work to be done with system catalog.\n  For example, to get function name using it's Oid. So, system catalog (system cache)\n  can be modified during extension work.\n\n## Contributing\n\nGo to [Issues](https://github.com/ashenBlade/postgres-dev-helper/issues) if you want to say something: bugs, features, etc...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashenblade%2Fpostgres-dev-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashenblade%2Fpostgres-dev-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashenblade%2Fpostgres-dev-helper/lists"}