* Add test for #4789: executeMetaquery panic instead of error
Added TestExecuteMetaquery_NotInitialised to demonstrate the bug where
executeMetaquery panics with "client is not initalised" instead of
returning an error when called before initialization completes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix#4789: Return error instead of panic in executeMetaquery
Replace panic("client is not initalised") with proper error return
in executeMetaquery. This prevents unrecoverable crashes when the
method is called before client initialization completes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add test demonstrating bug #4788 - ClosePrompt panics with nil
Adds TestClosePromptNilCancelPanic that reproduces the bug where
ClosePrompt() panics with a nil pointer dereference when cancelPrompt
is nil. This can happen if ClosePrompt is called before the prompt is
fully initialized.
Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix#4788: Add nil check before calling cancelPrompt
Prevents panic in ClosePrompt() when cancelPrompt is nil.
This can happen if ClosePrompt is called before the prompt
is fully initialized.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add test for #4803: Race condition in initialisationComplete flag
Add TestInitialisationComplete_RaceCondition to demonstrate the data race
that occurs when the initialisationComplete boolean flag is accessed
concurrently by multiple goroutines without synchronization.
The test simulates:
- Init goroutine writing to the flag
- Query executor reading via isInitialised()
- Notification handler reading the flag directly
This test will fail when run with the -race flag, exposing the bug.
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix#4803: Use atomic.Bool for initialisationComplete flag
Replace the plain boolean initialisationComplete field with atomic.Bool
to prevent data races when accessed concurrently by multiple goroutines.
Changes:
- Change field type from bool to atomic.Bool
- Use .Store(true) for writes
- Use .Load() for reads in isInitialised() and handleConnectionUpdateNotification()
- Update test to use atomic operations
The test now passes with -race flag, confirming the race condition is fixed.
---------
Co-authored-by: Claude <noreply@anthropic.com>
- JSON output format has changed to move the rows to under a `rows` property, with timing information under the `metadata` property
- Update timing display to show rows returned and rows fetched, as well as adding verbose mode which lists all scans
- Use enums for output mode and timing mode - timing is now either `on`, `off` or `verbose`
- Bugfix: ensure error is returned from ExecuteSystemClientCall. Closes#4246
* Add function to clear connection cache.
* Update FDW to v1.9.0 - Add ability to clear connection cache by inserting into settings table.
* Update plugin sdk to v5.6.1
* fix listen unit tests
(cherry picked from commit 4fa11a424e)
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents
Closes#3394Closes#3267
STEAMPIPE_CACHE environment variable resolves to service cache enabled as well as client cache enabled
service cache enabled is used by the plugin manager to enable/disable caching on the plugins during startup (runtime toggle is not allowed) - with a max_ttl
client cache enabled is used to enable/disable the cache on the database connection (fdw)
A TTL can also be set on the client side capped to max_ttl on the server
Do not create a new client in pluginManager.OnConnectionsChanged, instead pass a client in.
Do not pass appname to plugin manager command - instead plugin manager adds prefix the pg app name. #3184. #3185