All notable changes to the "PostgreSQL Hacker Helper" extension will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Show values of attributes in TupleTableSlot. They are shown in $attributes$ member and only tts_nvalid count.
Do not perform any memory allocations and syscache usage if we are inside Bump memory context. Otherwise pfree will throw an ERROR.
Added missing await for checkCanAlloc.
Internal special error, thrown when we can no longer send requests to debugger, i.e. because variables view was not updated, so we tried to use outdated handles (variablesReference).
VS Code setting Max container length to limit amount of elements shown in container types.
Default is 128.
Support value structs in Arrays when formatting watch expression.
Custom descriptions for types: RangeTblEntry shows table name, RelFileNumber is shown as spc/db/file and some others.
Show Bitmapset elements without array indexes.
Some internal function optimizations for performance.
Special members for TupleDesc were not handled correctly and did not work.
Syntax support for postgresql.conf with highlighting of units (possibly quoted) and default GUC autocompletion (with builtin contribs).
Add nodetags parameter configuration for custom NodeTag values (if some are missing).
When debugging starts will be started a worker which will parse nodetags.h file.
If it finds new unknown NodeTags you will be asked to automatically add these to configuration file.
Fix invalid check of safe state when getting elements of HTAB
Generalize "htab" and "array" configuration entries in order to not specify whether extension should check it's a member or a variable, because this information is clear from context.
General performance optimization: lazy evaluation of functions, optimizations of parsing functions, improved caching strategy, etc...
Support flexible array members as array members, so they are expanded as normal arrays.
Display XLogRecPtr in File/Offset hex form (like PG does), not integer.
Support for integer enums which elements defined using #define preprocessor.
Tests for formatter module.
Normalize function names passed to configuration files, so cppdbg and CodeLLDB notations do not conflict.
Some array members with scalar types are not displayed for CodeLLDB.
Formatter module now works with pgindent instead of invoking pg_bsd_indent directly.
Array members now specified in "arrays" section in configuration, instead of "specialMembers" -> "array".
Internal state initialization using knowledge of pg version using server_version_num GUC parameter. This is for initialization of internal runtime properties and acquiring enum members according to version.
Internal state reinitialized each debug session start with configuration file updates.
Add some more array special members (from execnodes.h).
Add command Find custom typedefs.list in repository to quickly find typedefs.list files in repository (just creates terminal and executes simple shell command).
Cached typedefs.list file now stored in .vscode directory instead of global /tmp. This fixes issue with multiple PG versions with different set of typedefs used - can lead to incorrect formatting.
typedefs setting now accepts additional custom typedefs.list files which will be just added to result. This is more convenient, because you don't have to create final file manually anymore.
If pg_bsd_indent must be build, then pg_config path is searched in src/tools/pgindent instead of directly asking user to enter full path to it.
Improve performance by caching current context properties, i.e. if it is safe to call palloc, etc...
Handle ROWID special varno when rendering Var expression.
Support for generic expressions for length expression in array special members.
Add more builtin array special members.
Check length in array special members not greater than 1024 to prevent errors/bugs.
Show expression in PlaceHolderVar instead of EXPR placeholder.
Attribute was not rendered if it does not have alias member set.
Search context or cxt variable in walkers/mutators to find rtable and render attributes in Expr variables.
Do not show int type for Bitmapset elements.
Dump node objects into text file/document (not log file using pprint). Menu option is available for variables.
Support CodeLLDB for 'Dump node to stdout' command.
Support for CodeLLDB debugger extension. Totally, C/C++ and CodeLLDB now supported.
Display bitmapword as bitmask, not integer. Also, bitmask is padded by 0 for length equal to nearest power of 2.
Show elements of Hash Tables: HTAB and simplehash (code gen from lib/simplehash.c).
User can specify types of elements of custom HTAB/simplehash in configuration files.
Add basic snippets: IsA, foreach, PG_TRY/PG_CATCH/PG_FINALLY.
Add node tags from PG18beta1.
Add join_rel_level to builtin array special members.
Bitmapset elements stop iterating when encounters 0.
Do not show = in variables view.
Dump Node to stdout command not worked, because frameId not passed for evaluation.
Add variable from PG Variables to Watch view in debug view container.
Copy logic of get_rte_attribute_name function to get name of attribute for Var representation to prevent possible ERROR exceptions.
Binary features info was cached only for current debug session and invalidated on debugger step. Now it used the same for whole debug session.
Typedef logic not worked correctly for Node variables. Specifically, MemoryContext - it was shown as MemoryContext even if it's type is AllocSetContext.
Do not show List as expandable in PG Variables, if it is empty (NIL).
Do not show words member for Bitmapset.
Add more validity checking for Bitmapset: check NodeTag (for 16+ version) and pointer validity (for older versions).
Support for Value structs with different NodeTags (for old versions) - show actual value according to it's NodeTag (not whole union, but only required field).
Custom pointer types for List *. Earlier, all T_List elements were casted to Node *, now some List * variables/members have elements with their real stored types.
I.e. RestrictInfo->scansel_cache is a List * that stores MergeScanSelCache structs (it is not Node).
Now such Lists displayed with their type.
User can define their own custom pointer types using configuration file. Configuration file layout updated (new field for this feature), current version 4.
Add more checks when working with system catalog or some other functions. I.e. Oid/pointer checks, MemoryContext checks when allocating memory, etc...
Memory leaks when evaluating Expr representation (pointers got from get_func_name and get_opname were not pfree'd).
Caching of Expr representations worked incorrectly. That led to performance decrease (and more memory leaks).
Track some binary features of postgres instance in current debug session. I.e. whether it have bms_next_member or not. (performance feature)
Do not show initial_elements, head and tail members of List *.
Errors messages appearing in bottom right corner when making debugger steps too fast and 'PG Variables' view interrupted during step.
Show text representation of expressions in variables (separate pseudo-member $expr$).
Show text representation of expressions contained in TargetEntry, EquivalenceMember and RestrictInfo in description field (old pointer value).
Update configuration file contents created by command. Set version to 3 and aliases member with empty array.
Pre-release
Add typedefs setting to configuration file. This allows to set custom typedefs.list file for using by formatter. This is helpful when you working on patch which changes this file and you do not want to constantly modify global cached (by extension) typedefs file.
This also updates version of configuration file to 3.
No changes
Add typedefs.list file preprocessing for feeding to pg_bsd_indent. Processed file saved in /tmp/pg-hacker-helper.typedefs.list file and may be reused between different sessions. Without processing raw file (downloaded from buildfarm) pg_bsd_indent produces invalid formatted code.
Add pre and post steps around running pg_bsd_indent to handle some formatting cases, like single space between type name and *. Relates to bug #3.
Fix pg_bsd_indent Path setting not handled due to code constants misuse. Relates to bug #2.
Add extension files bootstrapping: Makefile, *.c, *.sql, *.control, tests.
To create extension this way need to run command Bootstrap extension from
command palette.
Support for fixed size array expansion. Type of field must be in form type[size].
Fix invalid struct detection in variables view: top level structs are not expandable.
Fix variable length arrays fields displayed as expandable. I.e. for List last
field previously was displayed as expandable, but there are no elements shown.
- Support for custom PostgreSQL source code directories. It can be set using
postgresql-hacker-helper.srcPathin settings. This setting is used to start searching for required files (i.e. default node tag files orpg_bsd_indent). NOTE: if custom NodeTag files are set with relative path - search start from workspace directory, not your customsrcPath.
- Invalid message formatting for VS Code greater than 1.74.0. Caused by incompatible (with extension's) formatting logic used.
-
Formatting using
pg_bsd_indentwithFormat DocumentVS Code functionality. Supported for PostgreSQL starting from 10 version. -
Show elements to which
BitmapsetandRelidspoints: Relids (RangeTblEntryandRelOptInfo) or index in array (show element of that array)
- Integration with VS Code logging (output channel). Now can specify log level in
Outputwindow.
aliasesparameter in configuration file now works for every type, not only Node types.
- Check breakpoint in
bms_first_memberfunction to avoid infinite loop when evaluating bms elements. - Add support for
MemoryContextNode
-
Compatibility with PostgreSQL starting from 8.0 version. This includes:
- Linked List implementation of
List Bitmapsettraversal usingbms_first_memberand temp objectBitmapsethandling for versions up to 16, when it was not Node type
- Linked List implementation of
-
Compatibility with VS Code versions starting from 1.30. But some features can be unaccessible due to API incompatibility.
In example some versions do not have
Dump Node to stdoutin variables debug context menu. -
Add more NodeTags - searched from version 8.0 to 17. Current amount - 558.
-
Log level not updated until restart of extension (or VS Code).
-
Invalid Node casting when declared type has
structqualifier and NodeTag type do not have it.Example:
typedef JoinPath NestJoin(for versions up to 14) - failed to show members when declared type isstruct Path *.
- Invalid cast to
List- show members of declared type, not based on tag. I.e. whenNode *is declared type, butT_Listreal tag value - shown members were forNode(singletypemember).
-
137 new array special members. Total amount - 170.
-
Support for
Planstructs for observing Node variables.
-
Optimize extension startup path: remove function dependencies, no depending on NodeTag files
-
NodeTags stored as constant array in extension. Reading from file is not necessary for operating.
- Fix Bitmapset elements not shown for postgres version below 17.
Used function
bms_is_valid_setwas introduced in 17 version.
-
Support for
BitmapsetandRelids- show elements of set and it's length in$elements$and$length$pseudo-members. -
User defined type alises for Node types. Roughly speaking, it specifies
typedefs for types and when test for Node variable fails extension tries to substitute typename with given alias. This was introduced because oftypedef Bitmapset *Relids- there is noT_RelidsNodeTag.
-
Extension is activating automatically on presence of files:
pgsql_hacker_helper.json- extension's config filesrc/include/node/nodes.h,src/include/node/nodetags.h- files with NodeTag values (vs code settings not checked)
-
Update config file schema to 2 version - default version.
nodeTagmember replaced withtypeName: old behaviour was designed to support only Node variables, but now it allows any type to specify custom arrays. Also, innodeTagleading T_ prefix was removed, new member does not do it. -
Postgres variables view in debug container shows only when extension is activated and in debug mode.
T_XidListto supported List subtype
EPQStatefrom list of array special members - it does not have NodeTag
- More array special members. Totally - 36 special members.
- Separate json configuration file where you can add custom special members.
This file can be created manually or using command (in command palette)
PgSQL: Open or create configuration file (JSON) - Command and button to refresh Pg variables view: command palette and refresh button on top of Pg variables view. Note: normally, you don't need to run this, but when some errors happen and variables are not refreshed you can perform this action.
- Setting to specify log level.
Default:
INFOAvailable levels:DEBUGINFOWARNINGERRORDISABLE
- Setting to specify list of NodeTag files.
Default:
src/include/nodes/nodes.hsrc/include/nodes/nodetags.h
- Real NodeTag shows up in variable name (in square brackets) if it differs from declared.
This can happen when type of variable
Path *, but real path is ProjectionPath, so it showPath * [ProjectionPath]
- Only valid pointer variables are expanded in Pg variables view
- Separate view with
Node *variables expanded - Dumping
Node *to stdout usingpprintfunction