Commit Graph
8651 Commits
Author SHA1 Message Date
Dave Page a0b4c09772 Fix server update ignoring the connected-server check, and Connection.reset() never reconnecting. (#10567) 2026-10-14 11:37:03 +01:00
Dave Page 0389ee789a Bundle Python 3.13.16 in the Windows and macOS packages. (#10566)
Python 3.14 has to wait: the Windows build needs pywinpty, which is held
at 2.0.x for andfoy/pywinpty#545, and 2.0.x cannot be built for 3.14.
Note that beside both pins.
2026-10-14 10:45:54 +01:00
Dave Page 26a7d92b0b Fix the Linux packages shipping a stray copy of Python as venv/bin/𝜋thon. #10414 (#10564)
Python 3.14's venv module creates a "𝜋thon" symlink next to python,
python3 and python3.X (CPython gh-119535). The hash bang fixup runs
"sed -i" over venv/bin/*, which replaces every symlink with a regular
copy of its target; the python* links are recreated afterwards, but the
new alias was not, so packages built against Python 3.14 shipped a full
copy of the interpreter under that name, and dpkg on Ubuntu 26.04 fails
to unpack it. Nothing uses the alias, so remove it when the venv is
created.
2026-10-13 14:56:32 +01:00
Sanskar Kharya e02150e634 Fix the Dashboard Logs tab failing on multi-byte characters split across read chunks. #10511 (#10526)
The Logs tab reads the current log file in fixed-size byte ranges with
pg_read_file(), which raises 'invalid byte sequence' (SQLSTATE 22021)
when a range boundary falls inside a multi-byte character, so Tabular
format failed on logs containing non-ASCII text. The ranges are now read
with pg_read_binary_file(), transported as hex and decoded in pgAdmin
using the server encoding. Tabular reads fetch a few bytes of overlap so
a character split at a page boundary is shown whole on one page, and
genuinely invalid bytes are shown as replacement characters rather than
raising an error. For the EUC family of server encodings a page boundary
can still garble one character, as lead and trail bytes share ranges.

- Keep valid text after an invalid byte near the end of the file, trimming only a character still being written.
- Treat a truncated character in the CJK codecs as incomplete rather than invalid.
- Correct the encoding limitation comment, as GBK and GB18030 are not server encodings.
2026-10-13 13:23:44 +01:00
Dave Page 3e6f0c0703 Make server tests restore the shared test fixture after themselves. #10553 (#10562)
Several tests changed the server dict that the runner shares between all
tests (shared, service, SSH tunnel settings and so on) and never put it
back, so later tests inherited those settings; running the whole server
test package locally made the non-owner tests in
test_server_data_isolation.py fail with HTTP 428.

Move restore_server_fixture_on_cleanup() into servers/tests/utils.py and
call it from every test that modifies the fixture, including the sqleditor
new connection tests that added a password key, and stop the SSH mock
connect test relying on a tunnel_password key leaked by test_add_server.
2026-10-13 13:14:19 +01:00
Dave Page 1b05065eb0 Fix changing an identity column's START value also restarting its sequence. #10550 (#10561)
The column ALTER emitted RESTART SET START whenever START changed,
rewinding the identity sequence so the next generated value could
collide with existing rows; Schema Diff hit this too when only START
differed. RESTART is now emitted only when the sequence is still pending
at its old START with nothing generated since, or when its current value
would fall outside a new MINVALUE or MAXVALUE (which PostgreSQL refuses
without it). To decide, the column update reads last_value and is_called
from the sequence itself when START is set, since
pg_sequence_last_value() is NULL after any RESTART WITH.
2026-10-13 12:57:17 +01:00
Dave Page 8f24dc378d Add a test for Reset discarding pending SQL editor values in dialogs. #10552 (#10560)
The fix for #10357 remounts the dialog form on Reset so that SQL editor
values still waiting to come back through SchemaView are discarded. This
spec types into an SQL field, removes the edit, types again and presses
Reset before SchemaView has passed those values back, then checks that the
original value is shown. Without the remount the editor keeps the last
typed value.
2026-10-13 12:11:02 +01:00
Dave Page f4337dc8c7 Fix the cursor jumping to the start of SQL fields in dialogs after a quick edit and undo. #10551 (#10559)
When an edit and its undo (or a key, Backspace and the same key again) were
all reported before SchemaView passed the first value back, the editor's
pending values held the same text twice. Matching the newest copy dropped the
value in between, which then replaced the document when it came back. Values
come back in order, so InputSQL now matches the earliest copy; if some are
skipped, the leftover entries are cleared by later changes.
2026-10-13 12:10:01 +01:00
Dave Page fd4b47788b Fix column properties reporting an arbitrary parent for columns merged from several parents. #10554 (#10563)
The inherited-columns CTE joins on column name, so a column merged from
more than one parent produced a row per parent, and DISTINCT ON then
kept whichever came first. Order by the inheritance sequence number so
the first parent in inheritance order is always reported.
2026-10-13 12:07:32 +01:00
Dave Page 74003c19dc Fix Schema Diff not removing a column comment that exists only in the target. #10549 (#10556)
A source column without a comment has a description of None, which the
column update template skips, so the comment was reported as a difference
but never dropped. Send an empty string in that case, as the column dialog
does when a comment is cleared, so COMMENT ON COLUMN ... IS '' is
generated.
2026-10-13 12:06:01 +01:00
Dave Page a11fc0b921 Fix valid escapes below U+0100 being rewritten in SQL_ASCII data and names. #10547 (#10558)
The SQL_ASCII codec unescaped every valid \uXXXX and \UXXXXXXXX
sequence, so a value or column name containing '\u0041' was shown as
'A', and saving the row wrote 'A' back.

Decode each byte as latin-1 and only unescape escapes for code points
from U+0100 to U+10FFFF, which are the only ones pgAdmin writes when
encoding. Lower escapes and invalid sequences are kept as their literal
bytes. Encoding is unchanged.

- Decode long runs of backslashes in linear time in the SQL_ASCII codec.
2026-10-13 12:02:55 +01:00
Dave Page 5811f55b08 Fix negative identity column options being dropped from the generated SQL. #10548 (#10557)
The column and table templates only emitted an identity option when its
value was greater than -1, which was meant to skip unset options but
also dropped every negative one. So on a descending identity column,
changing INCREMENT to -2 in the column dialog or a MINVALUE difference
in Schema Diff produced no ALTER at all, and the table's CREATE SQL lost
its INCREMENT, START, MINVALUE and MAXVALUE. Test for an unset option
explicitly instead.
2026-10-13 12:02:05 +01:00
Dave Page d1374536d8 Fix flaky test_windows_pty_failures counting psql emits from other tests. #10546 (#10555)
The tests patch psql.sio.emit globally, so a psql session from another
test that is still running can emit pty-output into the same mock. Only
count the emit calls sent to the test's own room.
2026-10-13 12:01:47 +01:00
Dave Page 04684e798a Fix View/Edit Data failing on SQL_ASCII databases when a name contains a backslash followed by 'u' or 'U'. #5940 (#10545)
pgAdmin uses raw_unicode_escape as the Python codec for SQL_ASCII
connections, and psycopg decodes column names and query text with it.
A name such as "C:\User\te" contains '\U' that is not a valid
\UXXXXXXXX escape, so decoding raised "truncated \UXXXXXXXX escape".

Register a pgAdmin codec that behaves like raw_unicode_escape but keeps
invalid escape sequences as their literal bytes, and use it for
SQL_ASCII. Encoding is unchanged.
- Give the SQL_ASCII codec incremental support, and keep invalid escapes in server errors.
2026-10-13 08:18:24 +01:00
Dave Page 8df5306ebd Fix debugger messages from successive steps running together on one line. #8664 (#10544)
Each poll of the debugger returns its own batch of notices without a
trailing newline, so appending them directly ran messages from separate
steps together. Start each appended batch on a new line.
- Clarify that debugger message batches only usually lack a trailing newline.
2026-10-13 08:03:35 +01:00
Dave Page ab632646ed Fix the cursor jumping to the start of SQL fields in dialogs when keys are pressed together. #10357 (#10543)
SchemaView passes a field's value back a render or two after the change,
so when two keys are pressed almost at once the SQL editor could be handed
the value from the first key whilst already holding the second. Applying
that older value replaced the whole document, which moved the cursor to
the start. InputSQL now remembers the values the editor has reported and
ignores one that is older than the editor's current content.
- Remount the dialog form on Reset so pending SQL editor values are discarded.
2026-10-13 07:07:43 +01:00
Dave Page 43d1d59e00 Fix Schema Diff reporting identical tables as different when a foreign key's referenced table has a dropped column. #10446 (#10542)
pg_constraint.confkey holds the attribute numbers of a foreign key's
referenced columns, which differ between databases when a column has been
dropped from the referenced table in only one of them. The referenced
columns are already compared by name, so ignore confkey as conkey already
is.

A foreign key whose referenced columns differ is now dropped and
recreated, rather than being reported as different with an empty diff.
2026-10-13 06:31:01 +01:00
Dave Page 149170195d Fix the generated SQL to use a single GRANT statement for roles with identical privileges. #6231 (#10541)
parse_priv_to_db() now merges ACL entries that grant exactly the same
privileges, from the same grantor, into one entry listing every grantee,
so the templates for all object types produce
'GRANT ... TO role1, role2;' rather than one statement per role.

A privilege whose grantee is changed away from PUBLIC now also revokes
PUBLIC's privileges, rather than leaving them in place.
2026-10-13 05:36:19 +01:00
Dave Page e0a2d2138e Fix Schema Diff repeating unchanged column comments and identity options. #10422 (#10540)
Schema Diff passes a changed column with all of its properties, but the
column update template emitted COMMENT ON COLUMN and every identity
sequence option without comparing them with the column as it stands.
So any difference in an identity column repeated its unchanged comment,
and repeated START as RESTART SET START, which rewinds the identity
sequence on the target. Only emit those that actually differ.
2026-10-13 05:15:06 +01:00
Dave Page b10718d616 Fix Reset Layout dropping Query Tool tabs from the saved application state. #10424 (#10539)
resetLayout() re-opened the non-default tabs without their metaData, so
the layout saved straight afterwards stored them as bare ids and loadTab()
had nothing to rebuild them from on the next load. Their group is now
carried over as well, rather than falling back to 'default'.
2026-10-13 04:13:55 +01:00
Dave Page 3ec0aafa36 Fix UNLOGGED handling for partitioned tables and their partitions. #9057, #9836 (#10538)
PostgreSQL 18 rejects UNLOGGED on a partitioned table, in both CREATE
TABLE and ALTER TABLE ... SET UNLOGGED/LOGGED, so on PG18 and later
the Unlogged switch is now disabled for partitioned tables (including
a partitioned partition) and the generated CREATE, ALTER and reverse
engineered SQL no longer include it. Leaf partitions can still be
unlogged, and older servers are unchanged.

The Partitions SQL section of a partitioned table's script also now
keeps UNLOGGED for partitions that are unlogged, which it previously
dropped.
2026-10-13 04:03:21 +01:00
Dave Page 6a90e4f837 Remove the dead usr key from sqleditor.connect_server URLs. #10418 (#10536)
The route has no user placeholder, so url_for() always dropped it and
the backend never read it; the now-unused user argument is removed
from the connect-server helpers too.
2026-10-13 02:44:28 +01:00
Dave Page ccdb1f6271 Fix the Query Tool saving files that were loaded as latin-1 back as UTF-8. #10531 (#10537)
The latin-1 read fallback now records the encoding, and encodings are
tracked per resolved file path rather than by basename, and only after
a save succeeds.
2026-10-13 02:35:01 +01:00
Dave Page 3d5661ed87 Refresh a stale ServerManager when a server id is reused. #6090 (#10312)
A cached manager whose server definition no longer matches is rebuilt,
and the owner's settings are deep-copied before being overlaid for
shared-server users.
2026-10-13 02:14:07 +01:00
Dave Page 6404865bd5 Restore SCHEMA_VERSION 53, reverted by mistake when squashing #10330.
The #10330 branch added and then dropped a schema version bump; replayed
on top of #10506, which also took version 53, the squash set it back to
52 even though the server_passexec_name migration remains.
2026-10-13 01:26:42 +01:00
Dave Page e28b84ed67 Restore tags for standard users on shared servers, and never inherit the owner's passfile. #10136 (#10330)
Tags are copied to a user's shared server entry, whilst passfile is
treated like passwords, SSH keys and SSL client files and is never
copied from or overlaid with the owner's value.
2026-10-13 01:26:15 +01:00
Dave Page fc12b2e36b Pass every supported connection parameter to the utilities. (#10450)
Connection parameters with a libpq environment variable are exported to
pg_dump, pg_restore, psql and the other utilities, PGSERVICE comes from
the per-user server manager, and boolean parameters stored as strings
are normalised consistently with the main connection path.
2026-10-13 01:21:49 +01:00
Dave Page 34908c4093 Spawn psql directly on Windows instead of via cmd.exe. (#10453)
psql is launched directly through pywinpty, read errors end the session
cleanly, spawn failures are reported to the terminal, and the pty is
closed when the session ends.
2026-10-13 00:58:14 +01:00
Dave Page 5a56a3f3dc Allow editing data through simple auto-updatable views. #2363 (#10322)
Views with a single base table, all of its primary key columns exposed,
no INSTEAD OF triggers and no rules other than _RETURN can be edited in
View/Edit Data. Updates and deletes are checked row by row, and adding
rows is disabled because inserts through views are not supported.
2026-10-13 00:56:35 +01:00
Dave Page bee294a373 Normalise the dashboard TPS graph by the measured time between samples. #10273 (#10324) 2026-10-13 00:30:24 +01:00
Dave Page 224c486c58 Exclude non-editable alias and expression columns from Query Tool UPDATE saves. #10103 (#10329) 2026-10-12 23:51:08 +01:00
Dave Page 2a952d678d Fix the UI language not persisting beyond the request that set it in server mode. #10347 (#10351)
The chosen language is now kept in the session and cookie, and any
value not in config.LANGUAGES is ignored.
2026-10-12 23:46:37 +01:00
Dave Page 3a6f86a711 Fix OpenAI streaming tool calls being split into two entries. #10348 (#10352)
Accumulate Responses API function calls by item, treating output_index
and the item id as names for the same call, and use
response.output_item.done for the final name, call_id and arguments.
2026-10-12 23:29:25 +01:00
Dave Page e85db0fb8b Allow ADMIN OPTION holders to manage Group Role membership. #9450 (#10315)
Users holding ADMIN OPTION on a role, directly or through an inherited
membership as PostgreSQL itself allows, can now change its members,
whilst all other property changes still require CREATEROLE.
2026-10-12 23:23:48 +01:00
Dave Page 0cbddf21ba Fix the hardcoded table OID in the column properties query. #10534 (#10535)
The inherited-columns CTE compared pg_inherits.inhrelid with a fixed
OID instead of the table being queried, so inherited columns were never
reported as such on PostgreSQL 14 and later.
2026-10-12 23:15:52 +01:00
Dave Page e2e588c324 Skip virtualisation for small DataGridView grids to avoid a re-measure on tab show. #10143 (#10331) 2026-10-12 22:58:30 +01:00
Dave Page 6302a70316 Drop the scaffolding default partition after Schema Diff rebuilds a partitioned table. #10301 (#10316)
The temporary default partition is dropped when empty and is not created
at all for hash-partitioned tables, which cannot have one.
2026-10-12 22:17:59 +01:00
Dave Page c41b606795 Replace free-text server-mode password exec commands with an administrator allowlist. (#10506)
In server mode, users choose a password exec command by name from
SERVER_PASSEXEC_COMMANDS rather than entering a command line. Existing
commands are converted on upgrade once the allowlist is configured; if
it is empty the conversion is postponed and a warning is logged.
2026-10-12 21:56:11 +01:00
Dave Page d924c15e79 Pass the target database to utilities as a connection string. #10463 (#10464)
The database is passed as a dbname= connection string, quoted when
needed, so service files and unusual names work, and backup and
import/export require a database for object-level jobs.
2026-10-12 21:47:33 +01:00
Dave Page 1530b3551d Don't refuse symlinks or force 0o600 permissions when saving files in desktop mode. #10482 (#10529)
O_NOFOLLOW and the 0o600 mode are only applied in server mode, and the
symlink refusal message is only reported when O_NOFOLLOW was set.
2026-10-12 21:34:38 +01:00
Dave Page 32f9b4a8f6 Fix Schema Diff scripts that convert a column to or from SERIAL. #10292 (#10318)
Converting a plain column to SERIAL now creates the sequence with the
source sequence's own type, moves it past existing values and restores
the nextval() default; converting away from SERIAL drops the default
before the owned sequence.
2026-10-12 20:50:45 +01:00
Dave Page 6b8394fe31 Write cloud wizard credentials through to the session store for AWS, Azure and Google. #10527 (#10528)
The providers keep credentials and authentication state in nested dicts
in the Flask session, which ManagedSession does not detect as modified,
and FileBackedSessionManager may also defer the disk write. Add a
write_session_through() helper that sets both session.modified and
session.force_write, and call it wherever a provider stores or clears
state that a later request depends on.
2026-10-12 20:08:22 +01:00
Dave Page a9f2cb5405 Fix the Object Explorer shortcut not moving keyboard focus into the tree. (#10294)
The shortcut called focus() on the rc-dock tab pane, a plain div that
cannot take focus, so focus stayed where it was. Focus the react-aspen
tree inside the panel instead, which is already focusable, and draw its
focus indicator with the theme's activeBorder colour on :focus-visible.
2026-10-12 20:05:50 +01:00
Dave Page 7c974c005c Restore remembering the last visited directory in Desktop file dialogs. #10226 (#10327)
Electron 43 deliberately stopped remembering the last folder used by the
native open and save dialogs, so they always opened in Downloads. Track the
last visited directory in the runtime's config store and pass it as
defaultPath whenever the caller has not specified a location.
2026-10-12 17:17:52 +01:00
Dave Page b3a941c469 Add JSON and XML export, output encoding, BOM and copy-with-headers options to the Query Tool results. #3205, #4128, #4129, #6695 (#10062)
Results can now be saved as JSON or XML as well as CSV, with preferences
for the output file encoding, prepending a byte order mark to CSV/TXT
files, and the default state of the grid's copy-with-headers toggle.
2026-10-12 17:17:43 +01:00
Dave Page 4682025f0c Fix BEGIN, COMMIT and ROLLBACK silently failing in the Query Tool under server cursor mode. #8991 (#10321)
execute_void() reused the cached server-side cursor, whose execute() cannot
run a transaction-control statement, and the resulting exception was
swallowed, so the statement never reached the database. Run such statements
through a throwaway plain cursor instead, and guard poll()'s error path
against a cursor with no query.
2026-10-12 17:16:32 +01:00
Dave Page e5b6728fa9 Improve keyboard shortcuts for tab switching, line duplication in the SQL editor, and Enter/Escape in dialogs. #3834, #5691, #7167, #7232 (#10067)
Tab switching now works when focus is inside a tool and defaults to
Ctrl+Alt+PageUp/PageDown, Ctrl/Cmd+Shift+D duplicates the current line or
selection in the SQL editor, and dialogs handle Enter and Escape
consistently.
2026-10-12 17:16:28 +01:00
Dave Page fad01ed776 Add the PostgreSQL 18 options to the Backup, Backup Server and Restore dialogs. #9064, #9066 (#10060)
Add --statistics-only, --no-policies, --no-data, --no-schema,
--no-statistics, --statistics and --sequence-data where the utilities
support them, gated on server version 18, and suppress combinations that
pg_dump, pg_dumpall and pg_restore would reject. The pg_dumpall --format
and pg_restore --exclude-database/--globals-only options were reverted
before PostgreSQL 18.0 and so are not included.
2026-10-12 17:16:24 +01:00
Dave Page d5bd079593 Fix index and constraint columns not being shown when their names require quoting. #6481 (#10039)
The expression check compared pg_get_indexdef() output, which is quoted,
with the raw attname, so such columns were treated as expressions and
dropped. Compare against quote_ident(attname) instead, and replace the
.strip('"') calls with an unquote_ident() helper that also unescapes
doubled inner quotes.
2026-10-12 17:16:20 +01:00
Dave Page 5fc540af73 Fix the collation and ctype query error for databases with a non-default LC_COLLATE. #9798 (#10040)
get_ctypes.sql wrapped a multi-row UNION in a scalar subquery, which failed
when a libc database's collation and ctype differed. Rewrite it as a flat
UNION, add a 15_plus variant, and read datlocale for ICU and builtin
providers on PostgreSQL 17+.
2026-10-12 17:16:17 +01:00