pgkiln 0.46.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/migrations/108_sql_history.sql +25 -0
- package/docs/apex-feature-parity.md +28 -2
- package/docs/guide/03-builder.md +89 -18
- package/docs/guide/08-security.md +1 -1
- package/docs/guide/10-tutorial.md +1 -1
- package/docs/guide/12-development.md +20 -2
- package/docs/guide/16-files.md +2 -2
- package/package.json +1 -1
- package/public/worksheet.css +244 -0
- package/public/worksheet.js +665 -0
- package/src/builder/ai-builder.ts +3 -3
- package/src/builder/object-actions.ts +166 -0
- package/src/builder/object-browser.ts +40 -25
- package/src/builder/querybuilder.ts +1 -1
- package/src/builder/sampledata.ts +2 -2
- package/src/builder/scripts.ts +3 -3
- package/src/builder/sql.ts +15 -73
- package/src/builder/table-editor.ts +219 -0
- package/src/builder/ui.ts +3 -3
- package/src/builder/unload.ts +8 -4
- package/src/builder/worksheet.ts +569 -0
- package/src/builder/workspaces.ts +1 -1
- package/src/sqlformat.ts +208 -0
- package/src/sqlplan.ts +133 -0
- package/src/sqlscript.ts +6 -2
- package/src/sqlworksheet.ts +278 -0
- package/src/tabledef.ts +226 -0
- package/src/unload.ts +14 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- ---------------------------------------------------------------------
|
|
2
|
+
-- 108: the SQL Worksheet's history (sprint 92, Database Actions DA-5:
|
|
3
|
+
-- SQL History). One row per statement a developer ran in the worksheet:
|
|
4
|
+
-- the text, how it ended (ok or error), the rows and the time. Running
|
|
5
|
+
-- the same statement again right after counts on the same row (runs,
|
|
6
|
+
-- at), so repeated runs don't flood the list. Kept per developer and
|
|
7
|
+
-- workspace, at most 500 rows each (the builder deletes older ones).
|
|
8
|
+
-- The builder reads and writes it as the owner; nobody else has grants.
|
|
9
|
+
-- The activity log keeps its own 'sql_command' entries (the SQL Workshop
|
|
10
|
+
-- home's Recent SQL Commands).
|
|
11
|
+
-- ---------------------------------------------------------------------
|
|
12
|
+
create table meta.sql_history (
|
|
13
|
+
id bigint generated always as identity primary key,
|
|
14
|
+
username text not null,
|
|
15
|
+
workspace_id int not null default 1 references meta.workspace on delete cascade,
|
|
16
|
+
sql text not null check (length(sql) <= 20000),
|
|
17
|
+
status text not null check (status in ('ok', 'error')),
|
|
18
|
+
rows bigint,
|
|
19
|
+
ms int,
|
|
20
|
+
error text,
|
|
21
|
+
runs int not null default 1,
|
|
22
|
+
at timestamptz not null default now()
|
|
23
|
+
);
|
|
24
|
+
create index sql_history_user_idx on meta.sql_history (username, workspace_id, id desc);
|
|
25
|
+
comment on table meta.sql_history is 'The SQL Worksheet''s history per developer and workspace (108); installation data, not exported';
|
|
@@ -7,7 +7,7 @@ open item and open an issue or pull request; see [CONTRIBUTING.md](../CONTRIBUTI
|
|
|
7
7
|
Legend: ✅ available · 🟡 partial (see notes) · ❌ not yet · ➖ not planned (a deliberate choice,
|
|
8
8
|
or better served by the PostgreSQL ecosystem; see the notes and [extensions](guide/15-extensions.md))
|
|
9
9
|
|
|
10
|
-
Last reviewed: 2026-10-
|
|
10
|
+
Last reviewed: 2026-10-16 (sprint 95: Table Properties: create, edit or copy a table in a form with a DDL preview and Apply in one transaction; sprint 94: an object's menu with Open in a panel, Quick DDL, Add index / trigger / policy and Drop with dependents; sprint 93: worksheets saved as SQL Scripts with tabs and a Files list, Format, Convert case, find and replace, bind and substitution variables; sprint 92: the worksheet's Query Result with sort, value dialog, copy and downloads, plans as a tree with the slowest step and misestimates, SQL History with status, search and run again; sprint 91: the SQL Worksheet like Database Actions' SQL: navigator, Run Statement at the cursor and Run Script with a log per statement, Explain Plan, Autotrace, notices, history, Run as an application role; sprint 90: Comment Out in the page designer, gallery labels in title case; sprint 89: the Object Browser's schema, one row of tabs, blank NULLs, Modify column; sprint 88: home cards with colour bands and round icons, the hero on the page background, a page footer with the version and Back to top; sprint 87: the Create Application wizard reloads the page list for a schema, RLS badges, the alias from the name; sprint 86: the page designer by page number, HTML error pages in the builder; sprint 85: the Form Designer, beyond APEX; sprint 84: the date picker, facet menus; sprint 83: Component Settings and Component Groups; sprint 82: Report Queries; sprint 81: Application Computations and Shortcuts in Shared Components; sprint 80: the master grid's first row selected when the page opens and after a search; grid cells as text with their format mask until edited, with cell navigation by arrow keys, Enter, F2 and Escape; sprint 79: generated dashboards with sums, donuts and lines, leaving out charts that say nothing; applications open in their own light or dark mode until the user chooses, per application; a user menu with Appearance and Sign in when signed out; the developer toolbar's App and Page texts and debug state; the report search's column scope in the magnifier; sprint 78: generated faceted search reports with one column per foreign key, the faceted search's total row count, Show all and Yes/No values, one search field, friendly headings and number formats in generated grids and master-detail pages, friendly names in the Create Application wizard's page list; sprint 77: the Page Designer's layout and tree by display position, button positions, the tree's context menu with Duplicate and Copy to other page, Show Common / Show All, Go to group and the Template Options dialog; display positions, button positions and side-column page templates at runtime; sprint 76: the interactive report's menus and pagination, date items in the date format; sprint 75: the SQL Workshop's Object Browser and tabs; sprint 74: the builder's information architecture: Shared Components grid, Settings tabs, application home search and tasks; sprint 73: the Create Application wizard on one page with page types and features; sprint 72: the runtime chrome compared with APEX 26.2's: the developer toolbar, the Iris look, the navigation bar's Help menu and Install button; sprint 71: generated applications compared with APEX 26.2's: labels, foreign key names in reports, file columns, format masks, the Home page and the dashboard; sprint 70: treemap, sunburst and timeline charts; sprint 69: dragging tasks on a Gantt chart; sprint 68: the Data Reporter's welcome page, Find my workspace; sprint 67: REST source catalogs from OpenAPI documents, a workspace's export and import (two rows added); sprint 66: a blueprint from an existing application; sprint 65: facet charts; sprint 64: approval vacation rules and expiration policies; sprint 63: range, box plot and stock charts; sprint 62: workspace preferences (SQL Workshop and RESTful services per workspace), extension links, Manage backups across applications, SQL Workshop utilities with object reports, About Database and a database monitor; sprint 61: the builder's screens compared with APEX 26.1: the workspace sign-in page, the Administration menu with workspace message, environment banner and utilization, the SQL Workshop home, the App Gallery, application groups and cross application reports (four rows added); sprint 60: isolated workspaces with their own database logins, row-level security on pgkiln's tables and workspace database roles, workspace administrators; sprint 59: the Page Designer's help pane, Quick edit from the developer toolbar; sprint 58: page groups; sprint 57: region templates hero, title bar, buttons container, inline dialog and drawer, wizard with wizard progress, the carousel; sprint 56: Generate DDL and Schema Comparison in the SQL Workshop, `pgkiln ddl` and `pgkiln compare`; sprint 55: an editable login page with a Login region and the Minimal page template, Forgot password through the application's mail service; sprint 54: interactive grid views, the single row view, group by and chart; sprint 53: application settings, user preferences and items kept per user, dynamic translations, `meta.data_export` and data export downloads, display image and geocoded address items; sprint 52: every dynamic action event and action, Ajax callbacks, an error handling function, the session timeout warning; sprint 51: checked imports, application backups, availability and Run only, feedback, type-specific attribute help; sprint 50: lost update detection, warn on unsaved changes, the URL and search regions with search configurations, the developer toolbar with a session state viewer, and e-mail through SMTP with OAuth2, Microsoft Graph, Amazon SES and HTTP APIs; import checks, application availability, property help and e-mail compared again; 2026-10-06: pgkiln 0.31.0, in progress: static application files and the Execute JavaScript dynamic action; region, item, dynamic action and process plug-ins; conditional and dynamic theme styles; XML and Excel in `meta.parse_data`, zips in SQL, `meta.v_boolean`; file items in S3-compatible object storage; map layers by the visible area and as vector tiles; a graphical query builder; tenants for workflows and tasks; application files as YAML and region static IDs; Lucide icons and icon modifiers; PWA push notifications; 0.30.0: 136 icons and an icon picker; an axe-core accessibility audit; cropping pictures; session sharing between applications; twenty-two built-in languages; 0.29.0: workspaces; the Iris base style; drawers; built-in template components including the metric card; Theme Roller dark-mode colours, live preview and template options on items and report columns; report selection across pages; instance settings; fourteen built-in languages; 0.28.0: AI with Claude and OpenAI; 0.27.0: Data Reporter; sample data generator; create application from several sheets, pasted data or existing tables; 0.26.0: working copies with a three-way merge; theme, library and boilerplate applications with subscriptions; 0.25.0: Gantt, pyramid and polar charts; map layers, clustering and server-side spatial filters; REST data sources that write back from forms and grids and synchronise into tables, OAuth2 password and refresh-token grants; debug messages per request and an install/upgrade log; `meta.web_request()` and `meta.parse_data()`; Theme Roller style variants and template options; 0.24.0: automations with several actions, error handling per row and runs from SQL; invoke-API workflow steps; Unload Data in the Data Workshop; create page wizards for cards, calendar, chart, map, faceted search, form and master-detail; create an application from a file; 0.23.0: interactive grid aggregates, frozen/moved/resized columns, layouts and saved grid reports, master-detail, row actions and copy/paste; download processes, execution chains in the background, workflow processes, branches to a function's URL or another app, the Dialog Closed event; number format masks, automatic time zone, runtime messages in German, French and Spanish; SQL scripts, Quick SQL, a query builder, XML loading and data load definitions; custom authentication, lists, page and application locks with developer comments, supporting objects; 0.22.0: keyset paging, report PDFs and REST collections streamed from a cursor, database-account authentication; 0.21.0: HTTP-header authentication behind a reverse proxy; 0.20.0: a popup list of values with server-side search; 0.19.0: row-range pagination, maximum row counts and row limits, lazy loading and caching of regions, streamed CSV/Excel downloads; 0.18.0: calendar week/day/list views with drag and drop, bubble/gauge/funnel/radar charts and drill-down, smart filters, a region display selector and more facet types, computations, conditional branches, build options, menu buttons, REST data sources and web credentials, rich text/Markdown, rating, combobox, date range and QR code items; 0.17.0: an App Builder home, workspace dashboard and utilities like APEX's; 0.16.0: a Page Designer with drag-and-drop layout, a code editor with autocomplete, template components and plug-ins, parallel branches and versions of workflows, the `pgkiln` command line with one file per component; 0.15.0: drop and paste files, heat maps, filtering a report by the map area; 0.14.0: stacked, combo, scatter and pie charts, several files per upload item; 0.13.0: map and tree regions; 0.12.0: REST modules in the builder; 0.11.0: workflows and Progressive Web Apps; 0.10.0: LDAP, SAML, "Keep me signed in", document templates, JSON loading, approvals and the task list; pgkiln installs no application, HR is an example).
|
|
11
11
|
|
|
12
12
|
## At a glance
|
|
13
13
|
|
|
@@ -184,7 +184,7 @@ two, REST source catalogs and the workspace export, with their features.)
|
|
|
184
184
|
|
|
185
185
|
| APEX | pgkiln | Notes |
|
|
186
186
|
|---|---|---|
|
|
187
|
-
| SQL Workshop: SQL commands, object browser | ✅ | (sprint 61) A **home page** like APEX's: tiles, recently created tables, your recent SQL commands and the workspace's recent scripts, and the session's **default schema** (first in the search path of SQL
|
|
187
|
+
| SQL Workshop: SQL commands, object browser | ✅ | (sprint 61) A **home page** like APEX's: tiles, recently created tables, your recent SQL commands and the workspace's recent scripts, and the session's **default schema** (first in the search path of the SQL Worksheet and Scripts). (sprint 91) **SQL Commands is the SQL Worksheet** like Database Actions' SQL: a navigator, the statement at the cursor or a script with a log per statement, Explain Plan and Autotrace, notices and history (see the Database Actions section below). (sprint 75) The **Object Browser** like APEX's: a schema in the header, a tree by object type (tables, views, materialized views, indexes, sequences, types, functions, procedures, triggers) with a filter and a Create menu, system and extension objects hidden unless asked, and a table in tabs (columns with Add/Rename/Drop column writing the ALTER TABLE to review, data in pages, indexes, constraints, triggers, grants, row level security, dependencies, statistics, DDL); the tools as main tabs and a More menu. (sprint 62) **Utilities** like APEX's: the tools on one page, **Object Reports** (tables without a primary key, unindexed foreign keys, row-level security without policies or not enabled, PUBLIC grants, unused indexes, largest tables, missing comments), **About Database** and a **Database Monitor** of sessions and blocked queries for administrators. **Missing:** a recycle bin (PostgreSQL has none), user interface defaults (pgkiln's wizards read the catalog and comments) |
|
|
188
188
|
| RESTful services (ORDS) | ✅ | [PostgREST](https://postgrest.org) next to pgkiln: `api` schema, the same RLS as the UI, per-app API role, tokens in the builder, a pre-request check, and **OAuth clients** (client credentials, like ORDS `oauth.create_client`) so tokens renew themselves |
|
|
189
189
|
| REST handler editor, REST-enabled SQL | ✅ | **REST modules** in the builder: handlers (method, path with parameters, SQL as collection, item or statements, roles, public) served by pgkiln with bearer tokens and an OpenAPI description; plus PostgREST for schema-wide APIs. **Missing:** REST-enabled SQL (rarely desirable) |
|
|
190
190
|
| SQL scripts, query builder, Quick SQL | ✅ | **SQL Scripts**: saved, upload/download, a result per statement, stop or continue on errors, optionally one transaction, run history. **Quick SQL** (a subset: tables, child tables, types, the main column directives, `/auditcols`, settings, views). A graphical **query builder**: tables as boxes on a canvas (dragged, placed where left), joins along foreign keys or drawn from column to column (inner or left), column functions with automatic `group by`, conditions, sort, open in SQL Commands; without JavaScript the same as forms ([chapter 3](guide/03-builder.md#sql-workshop)) |
|
|
@@ -334,3 +334,29 @@ Sources: [APEX 26.1 new features](https://docs.oracle.com/en/database/oracle/ape
|
|
|
334
334
|
| Map Backgrounds | ➖ Not planned per application: the installation's map tile server (`MAP_TILE_URL`) is every map's background |
|
|
335
335
|
| AI Attributes, AI Services, AI Agents | AI Services; AI agents ➖ not planned |
|
|
336
336
|
|
|
337
|
+
## Database Actions (SQL Developer Web) and the SQL Workshop
|
|
338
|
+
|
|
339
|
+
(sprint 91) Oracle's Database Actions, the ORDS tool next to APEX, is the standard for pgkiln's SQL Workshop, mapped
|
|
340
|
+
to PostgreSQL. pgkiln's own extras stay: Quick SQL, the Query Builder, Sample Data, Schema Comparison, Object Reports,
|
|
341
|
+
AI and row level security badges.
|
|
342
|
+
|
|
343
|
+
| Database Actions | pgkiln | |
|
|
344
|
+
|---|---|---|
|
|
345
|
+
| SQL worksheet: navigator, editor, output tabs, status bar | SQL Workshop → SQL Worksheet (sprint 91): navigator by schema and object type with columns, drag and drop and SELECT / INSERT / UPDATE / DELETE; Query Result, Script Output, Notices (DBMS Output), Explain Plan, Autotrace, SQL History; resizable panes, fullscreen | ✅ |
|
|
346
|
+
| Run Statement (Ctrl+Enter), Run Script (F5) | The statement at the cursor or the selection; a script with a log per statement (psql command tags, error line and column), stop or continue on error; Run as an application's role | ✅ |
|
|
347
|
+
| Explain Plan (F10), Autotrace (F6) | A tree of steps (sprint 92): cost, rows, conditions; with Autotrace (`EXPLAIN ANALYZE, BUFFERS`, rolled back) actual time, rows, loops, buffers, each step's own time, the slowest step and 10× misestimates; the text plan too | ✅ |
|
|
348
|
+
| Query Result grid (paging, download, sharing) | 500 rows (All rows: 10,000) with row numbers, numbers right-aligned, sort, a value dialog, copy, Download as CSV, JSON, XML, Excel or SQL inserts (sprint 92); no sharing links | ✅ |
|
|
349
|
+
| SQL History, DBMS Output | SQL History per developer with status, rows, time, search and run again; Notices with their time (sprint 92) | ✅ |
|
|
350
|
+
| Worksheets saved as files, tabs | Save, Save as, Rename, Download as SQL Scripts, a Files tab, worksheet tabs that survive a reload (sprint 93) | ✅ |
|
|
351
|
+
| Create Chart from a query, Charts | Charts in applications only | ❌ |
|
|
352
|
+
| Object context menu, table properties dialog, Quick DDL | An object's menu (sprint 94): Open in a panel, Quick DDL to the worksheet or a file, Load data, Add index / trigger / policy, Drop with its dependents; **Table Properties** (sprint 95): columns, keys, foreign keys, checks, indexes, comment, RLS, partitioning, DDL preview, Apply in one transaction, use as template | ✅ |
|
|
353
|
+
| Format, Convert Case, Find and replace, bind variables | Format (Ctrl+F7), Convert case, find and replace, Go to line, comment lines, `:NAME` and `&NAME.` asked for before a run (sprint 93); no guided tour | ✅ |
|
|
354
|
+
| Data Modeler (relational diagrams) | Query Builder joins only | ❌ |
|
|
355
|
+
| REST (modules, AutoREST) | Consumes REST (catalogs, sources); the application REST API | 🟡 |
|
|
356
|
+
| Scheduling | pgkiln's own jobs and automations | ❌ |
|
|
357
|
+
| Database Users | Application users and developers; roles in SQL | ❌ |
|
|
358
|
+
| Real Time SQL Monitor | Database Monitor (sessions) and Top SQL per application role | 🟡 |
|
|
359
|
+
| Launchpad, Search Database (Ctrl+K) | The SQL Workshop home | 🟡 |
|
|
360
|
+
| Data Pump | Application backups and Unload Data | 🟡 |
|
|
361
|
+
| Liquibase | Schema Comparison | 🟡 |
|
|
362
|
+
| JavaScript (MLE) | ➖ Not planned: PostgreSQL has plv8 as an extension | ➖ |
|
package/docs/guide/03-builder.md
CHANGED
|
@@ -84,7 +84,7 @@ builder page while the workspace is current.
|
|
|
84
84
|
Administrators and the workspace's administrators set them on the workspace's page (Administration menu →
|
|
85
85
|
*Workspace preferences*; APEX: Set Workspace Preferences):
|
|
86
86
|
|
|
87
|
-
- **Enable the SQL Workshop**: off, every SQL Workshop page (SQL
|
|
87
|
+
- **Enable the SQL Workshop**: off, every SQL Workshop page (the SQL Worksheet, the Object Browser, SQL scripts, Load and
|
|
88
88
|
Unload Data, Quick SQL, the query builder, Sample Data, DDL, Compare, AI) answers *403* while the workspace is
|
|
89
89
|
current, for every developer including administrators; the rail and Workspace utilities no longer show it. A
|
|
90
90
|
developer who belongs to another workspace can still use it there. Turn it off for a workspace whose developers
|
|
@@ -143,7 +143,7 @@ workspace → *Isolation*). It needs `RUNTIME_DATABASE_URL` (applications don't
|
|
|
143
143
|
|
|
144
144
|
- **Two PostgreSQL logins of its own**: `pgkiln_ws<id>_run_<suffix>` runs its applications (pages, processes, REST
|
|
145
145
|
handlers, automations, workflows, background processes, REST synchronisation); `pgkiln_ws<id>_dev_<suffix>` runs its
|
|
146
|
-
developers' SQL: SQL
|
|
146
|
+
developers' SQL: the SQL Worksheet, SQL Scripts, Quick SQL, Load and Unload Data, Sample Data, DDL and Compare, the
|
|
147
147
|
Advisor, code checks and document previews. SQL that runs `RESET ROLE` (or `set_config('role', …)`) only gets back to
|
|
148
148
|
that login, which can use the workspace's database roles and nothing else.
|
|
149
149
|
- **The workspace's database roles** (APEX: workspace schemas): isolating gives the workspace the roles its
|
|
@@ -1191,8 +1191,8 @@ administrator chooses it under **SQL Workshop → AI** (any enabled [AI service]
|
|
|
1191
1191
|
switches the builder's AI off). What it is used for:
|
|
1192
1192
|
|
|
1193
1193
|
- **SQL from a question** (SQL Workshop → AI): pick a schema and ask; the answer is a statement and
|
|
1194
|
-
a short explanation. It is **shown, never run**: check it, change it and run it in SQL
|
|
1195
|
-
yourself (*Run in SQL
|
|
1194
|
+
a short explanation. It is **shown, never run**: check it, change it and run it in the SQL Worksheet
|
|
1195
|
+
yourself (*Run in the SQL Worksheet*).
|
|
1196
1196
|
- **Explain a query or an error** (SQL Workshop → AI): paste a query, an error message or both
|
|
1197
1197
|
(optionally with a schema for context); the explanation is shown with simple formatting.
|
|
1198
1198
|
- **Describe tables for AI** (SQL Workshop → AI → *Describe tables*): per table or view, a
|
|
@@ -1246,34 +1246,105 @@ may use), a form to **issue a token** for an account, and `curl` examples. See
|
|
|
1246
1246
|
|
|
1247
1247
|
## SQL Workshop
|
|
1248
1248
|
|
|
1249
|
-
The SQL Workshop opens on its **home** (`/builder/sql`; APEX: the SQL Workshop home): tiles for the
|
|
1250
|
-
|
|
1251
|
-
PostgreSQL keeps no creation time, so object ids decide), your **recent SQL commands** (click one to open it in SQL
|
|
1252
|
-
|
|
1253
|
-
session's **schema** (APEX: the default schema): it goes first in the search path of SQL
|
|
1249
|
+
The SQL Workshop opens on its **home** (`/builder/sql`; APEX: the SQL Workshop home): tiles for the SQL Worksheet,
|
|
1250
|
+
the Object Browser, SQL Scripts, the utilities and Quick SQL; **Recently created tables** (the newest tables you can read:
|
|
1251
|
+
PostgreSQL keeps no creation time, so object ids decide), your **recent SQL commands** (click one to open it in the SQL
|
|
1252
|
+
Worksheet; other developers' are never shown) and the workspace's **recent SQL scripts**. The side column sets the
|
|
1253
|
+
session's **schema** (APEX: the default schema): it goes first in the search path of the SQL Worksheet and SQL Scripts until
|
|
1254
1254
|
you sign out. Tasks link to Quick SQL, blueprints, table descriptions, sample data and Generate DDL.
|
|
1255
1255
|
|
|
1256
|
-
(sprint 75) The tools are tabs: Home,
|
|
1256
|
+
(sprint 75) The tools are tabs: Home, SQL Worksheet, Object Browser, SQL Scripts and Utilities; **More** opens the
|
|
1257
1257
|
others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compare, AI), and the open one is a tab too.
|
|
1258
1258
|
|
|
1259
|
-
- **SQL
|
|
1260
|
-
|
|
1261
|
-
**
|
|
1262
|
-
|
|
1259
|
+
- **SQL Worksheet** (`/builder/sql/worksheet`, sprint 91; Database Actions: SQL; was SQL Commands, whose address
|
|
1260
|
+
`/builder/sql/commands` opens the same page): one screen with a **navigator** on the left, the **editor** with a
|
|
1261
|
+
toolbar, **output tabs** below and a **status bar**.
|
|
1262
|
+
- The navigator has a schema (the same one as the Object Browser), an object type (*All Objects*, tables, views,
|
|
1263
|
+
materialized views, indexes, sequences, types, functions, procedures, triggers, policies) and a search field.
|
|
1264
|
+
A table or view opens to its columns with their types (a key marks the primary key); drag it into the editor
|
|
1265
|
+
for a `SELECT` of all its columns, or use its **SELECT**, **INSERT**, **UPDATE** and **DELETE** buttons, which
|
|
1266
|
+
insert the statement at the cursor. Columns are listed for the first 400 tables and views of a schema.
|
|
1267
|
+
- (sprint 94) Each object has a **⋯ menu** (or right-click it; Shift+right-click keeps the browser's menu), in
|
|
1268
|
+
the Object Browser's tree too: **Open** shows the Object Browser's tabs in a panel at the side, without leaving
|
|
1269
|
+
the worksheet; **Quick DDL** puts the object's DDL into a new worksheet tab (with the search path set to its
|
|
1270
|
+
schema) or downloads it as a `.sql` file; for a table **Load data**, **Add index**, **Add trigger** (a trigger
|
|
1271
|
+
function and the trigger) and **Add policy** (row level security on, a policy to fill in); **Drop…** writes the
|
|
1272
|
+
DROP statement with a comment that lists what depends on the object (views, foreign keys…). Nothing runs: you
|
|
1273
|
+
review the statement and run it.
|
|
1274
|
+
- (sprint 95) **Table Properties** (a table's **Edit…**, **Use as template**, the Object Browser's *Edit table* and
|
|
1275
|
+
its *Table (form)* tile): a form with **Columns** (name, type, primary key, not null, default, identity,
|
|
1276
|
+
comment; move them up or down for a new table, remove them), **Unique keys**, **Foreign keys** (the table it refers
|
|
1277
|
+
to, its columns, on delete), **Checks**, **Indexes** (columns or expressions, unique; indexes with another method or
|
|
1278
|
+
a condition are kept as they are), the table's **comment**, **row level security** (and forcing it for the owner)
|
|
1279
|
+
and, for a new table, **partitioning** (range, list or hash and its key). **Preview DDL** shows the exact CREATE
|
|
1280
|
+
TABLE, or for an existing table the ALTER statements from what the catalog says now; **Apply** runs them in one
|
|
1281
|
+
transaction (nothing changes when one fails, and the error shows under *Output*); **Open in the worksheet** puts
|
|
1282
|
+
them there instead. *Use as template* starts a new table with the same columns and keys (names with `_copy`).
|
|
1283
|
+
Defaults, checks and index expressions are single expressions (no `;` or comments).
|
|
1284
|
+
- **Run Statement** (**Ctrl/Cmd + Enter**) runs the statement at the cursor: the one the cursor is in, else the
|
|
1285
|
+
nearest one before it. A selection runs as it is, even when it holds several statements. The rows of the last
|
|
1286
|
+
query show in **Query Result**, up to 500, with row numbers, numbers right-aligned and NULL as *(null)*. The
|
|
1287
|
+
statement that ran is selected again afterwards. (sprint 92) Click a column heading to sort the rows, a cell to
|
|
1288
|
+
see its whole value (JSON indented), **Copy** for the rows as tab-separated text, and **All rows** to run the
|
|
1289
|
+
statement again for up to 10,000 rows. **Download** saves a SELECT as CSV, JSON, XML, Excel or SQL inserts
|
|
1290
|
+
through Unload Data (a read-only transaction, so the query runs once more).
|
|
1291
|
+
- **Run Script** (**F5**) runs every statement in order and writes **Script Output**: for each statement its line,
|
|
1292
|
+
the rows as text (up to 50), its notices, and its command tag like psql's (`CREATE TABLE`, `INSERT 0 2`,
|
|
1293
|
+
`SELECT 14`) with its time. An error says its line and column in the worksheet; the cursor goes to that line.
|
|
1294
|
+
The script stops at the first error unless **Continue on error** is on. psql meta-commands and `COPY … FROM
|
|
1295
|
+
STDIN` / `TO STDOUT` are skipped (use Load Data and Unload Data).
|
|
1296
|
+
- **Explain Plan** (**F10**) shows the plan of the statement at the cursor; nothing runs. **Autotrace** (**F6**) runs
|
|
1297
|
+
it with `EXPLAIN (ANALYZE, BUFFERS)` in a transaction that is rolled back, so an UPDATE or DELETE changes
|
|
1298
|
+
nothing. (sprint 92) The plan is a tree of steps: the operation, the table or index, cost, estimated rows and
|
|
1299
|
+
width, and the step's conditions (filter, index and join conditions, sort keys). Autotrace adds the actual time,
|
|
1300
|
+
rows, loops and buffers, the time spent in the step itself, marks the **slowest step**, and flags estimates that
|
|
1301
|
+
are 10 times too high or too low (run `ANALYZE` on the table). **Text plan** shows it like psql.
|
|
1302
|
+
- **Notices** lists the `RAISE NOTICE`, `INFO` and `WARNING` messages of the last run with their time.
|
|
1303
|
+
**SQL History** (sprint 92) lists your last 200 statements in this workspace with how they ended, their rows and
|
|
1304
|
+
time; running the same statement again counts on its row (*3×*). Search it, show only the ones that failed or
|
|
1305
|
+
succeeded, click one to insert it at the cursor, **Run** to run it again, or copy it. Other developers' history
|
|
1306
|
+
never shows; 500 statements are kept per developer. The home page's *Recent SQL commands* opens it.
|
|
1307
|
+
- The status bar counts errors and warnings and shows the last message and its time.
|
|
1308
|
+
- (sprint 93) **Worksheets and files**: the worksheet's name is a menu with **Save** (**Ctrl/Cmd + S**), *Save as
|
|
1309
|
+
new*, *Rename*, **Download** (a `.sql` file), **New** and *Open…*. A worksheet is saved as a script of SQL Scripts
|
|
1310
|
+
(shared by the workspace's developers); the navigator's **Files** tab lists them, and SQL Scripts opens one in the
|
|
1311
|
+
worksheet. Several worksheets stay open as **tabs** above the editor (at most 20); a `*` marks text not saved yet.
|
|
1312
|
+
The tabs and their unsaved text are kept in the browser, so they survive a reload.
|
|
1313
|
+
- **Bind variables** (`:NAME`) and **substitution variables** (`&NAME.`) are asked for in a dialog before the run.
|
|
1314
|
+
A bind variable's value is a quoted literal (empty is NULL), so it can never change the statement; a substitution
|
|
1315
|
+
variable's text goes into the statement as it is (a table or column name, for instance). The values are
|
|
1316
|
+
remembered for the session; the history and the log keep the statement as written.
|
|
1317
|
+
- **Format** (**Ctrl + F7**) lays out the selection or the whole worksheet: a clause per line, the columns of a select
|
|
1318
|
+
list and the conditions of a WHERE one per line, joins and subqueries indented, keywords in lower or UPPER case
|
|
1319
|
+
(chosen in the **?** menu). Strings, comments and `$$` bodies stay as they are. **Convert case** (**Ctrl + B**)
|
|
1320
|
+
cycles the selection (or the word at the cursor) through UPPER, lower and Initial caps. **Find and replace**
|
|
1321
|
+
(**Ctrl + F**, **Ctrl + H**) with a regular expression or exact case, **Go to line** (**Ctrl + G**), and
|
|
1322
|
+
**Ctrl + /** comments the selected lines out or in. The **?** menu lists every key; **F1** opens this help. The
|
|
1323
|
+
upload button opens Load Data for the navigator's schema.
|
|
1324
|
+
- Each statement commits on its own. Statements run as the **owner connection** (an isolated workspace's
|
|
1325
|
+
developer login for its developers), on a connection of their own that is closed afterwards, so `SET ROLE` or
|
|
1326
|
+
`SET search_path` doesn't leak. **Run as** picks an application of your workspace instead: the statements then
|
|
1327
|
+
run as its database role, with `pgkiln.app_id` set, so its grants and row level security policies apply. Use
|
|
1328
|
+
it to test policies; it is no security boundary, since the SQL could `RESET ROLE`.
|
|
1329
|
+
- With script, the panes fill the window. Drag the splitters (or focus one and use the arrow keys) to resize
|
|
1330
|
+
them, hide the navigator, or use **Fullscreen** to see only the editor (**Escape** leaves). Sizes are
|
|
1331
|
+
remembered in the browser. Without script, the buttons post the form and the panes stack; Run Statement then
|
|
1332
|
+
runs every statement. The [code editor](#the-code-editor) suggests every schema, table, column and function
|
|
1333
|
+
you can use.
|
|
1263
1334
|
- **Object Browser** (APEX's): the **schema** in the header and a tree with a
|
|
1264
1335
|
folder per object type (tables, views, materialized views, indexes, sequences, types, functions, procedures,
|
|
1265
1336
|
triggers) and a **filter** by name. pgkiln's own schemas (`meta`, `pgkiln_plugins`) and objects that belong to an
|
|
1266
1337
|
extension show only with **Show system objects**. **Create** (and the tiles shown when nothing is selected) opens
|
|
1267
|
-
SQL
|
|
1338
|
+
the SQL Worksheet with a CREATE TABLE, VIEW, FUNCTION, SEQUENCE or INDEX statement to fill in. A table opens in tabs:
|
|
1268
1339
|
**Columns** (with comments; the toolbar's *Add*, *Modify* (type, nulls, default), *Rename* and *Drop column* write
|
|
1269
|
-
the ALTER TABLE statement into SQL
|
|
1340
|
+
the ALTER TABLE statement into the SQL Worksheet to review and run: nothing changes until you press Run), **Data** (25
|
|
1270
1341
|
rows a page; NULL is a blank cell), **Indexes**, **Constraints**
|
|
1271
1342
|
(primary key, foreign keys with the table they refer to, unique, check), **Triggers**, **Grants**, **Row level
|
|
1272
1343
|
security** (on or off, the policies), **Dependencies** (views and foreign keys that use it, and what it uses),
|
|
1273
1344
|
**Statistics** (rows, sizes, analyze and vacuum times) and **DDL**. A view has the same tabs where they apply; a
|
|
1274
1345
|
function or procedure shows its source, a trigger, index, sequence or type its definition. (sprint 89) The tabs stay
|
|
1275
1346
|
on one row: Columns, Data, Indexes, Constraints and DDL (and the current one), the others under **More**. The
|
|
1276
|
-
schema shown is the one you chose last (remembered for the session), else the session's schema of SQL
|
|
1347
|
+
schema shown is the one you chose last (remembered for the session), else the session's schema of the SQL Worksheet,
|
|
1277
1348
|
else the **parsing schema** of the application changed last in your workspace (the schema its database role
|
|
1278
1349
|
uses).
|
|
1279
1350
|
- **SQL Scripts**: saved scripts, shared by the developers of the workspace. Create one in the editor, upload a
|
|
@@ -1308,7 +1379,7 @@ others (Quick SQL, Query Builder, Load and Unload Data, Sample Data, DDL, Compar
|
|
|
1308
1379
|
note. Each join can be inner or left. Drag a table by its handle, or focus the handle and use
|
|
1309
1380
|
the arrow keys (Shift for bigger steps); it stays where it was left. On phones the tables are
|
|
1310
1381
|
stacked. Then pick conditions (`=`, `<>`, `<`, `like`, `in (a, b)`, `is null` …, combined with
|
|
1311
|
-
AND or OR), the sort, `distinct` and a row limit. The SELECT is shown and opens in SQL
|
|
1382
|
+
AND or OR), the sort, `distinct` and a row limit. The SELECT is shown and opens in the SQL Worksheet.
|
|
1312
1383
|
The state is in the URL (tables in the order chosen, joins, functions and the tables' places), so
|
|
1313
1384
|
a query can be bookmarked; everything except dragging works without JavaScript. Only names from
|
|
1314
1385
|
the catalog and the fixed functions are used, and condition values are string literals.
|
|
@@ -507,7 +507,7 @@ matures. Privileges show up in **SQL Workshop → Object Browser**.
|
|
|
507
507
|
A `data_load` process loads files as the app role too, also with a data load definition: a
|
|
508
508
|
definition naming a table the role can't write fails like any other insert, and a process only
|
|
509
509
|
finds the definitions of its own application. XML files with a document type declaration are
|
|
510
|
-
refused ([chapter 16](16-files.md#data-loading)). The SQL Workshop (SQL
|
|
510
|
+
refused ([chapter 16](16-files.md#data-loading)). The SQL Workshop (the SQL Worksheet, SQL Scripts,
|
|
511
511
|
Quick SQL, Load Data, Unload Data, Sample Data) runs as the owner instead, so every developer can change any table: keep
|
|
512
512
|
developer accounts to people you trust with the database.
|
|
513
513
|
|
|
@@ -20,7 +20,7 @@ Then open http://127.0.0.1:3100/a/tasks and sign in as `ann` / `ann-password` or
|
|
|
20
20
|
|
|
21
21
|
## Step 1: the table and the business logic
|
|
22
22
|
|
|
23
|
-
Open **SQL Workshop → SQL
|
|
23
|
+
Open **SQL Workshop → SQL Worksheet**, paste this and press **Run Script** (F5):
|
|
24
24
|
|
|
25
25
|
```sql
|
|
26
26
|
create schema tasks;
|
|
@@ -66,7 +66,12 @@ src/
|
|
|
66
66
|
sampledata-words.ts built-in name, city, company and word lists of Sample Data
|
|
67
67
|
unload.ts Unload Data: unloadStatement() (one SELECT), openUnload() (cursor, batches, CSV/JSON/XLSX/XML encoders on Postgres text values)
|
|
68
68
|
xml.ts safe XML reader (no DTDs or entities, limits) and xmlTable(): rows from a repeating element (unit tested)
|
|
69
|
-
sqlscript.ts SQL scripts: splitScript() (statements, line numbers, psql commands), runScript() (stop/continue, transaction, savepoints)
|
|
69
|
+
sqlscript.ts SQL scripts: splitScript() (statements, line numbers and offsets, psql commands), runScript() (stop/continue, transaction, savepoints)
|
|
70
|
+
sqlworksheet.ts (sprint 91) the worksheet's runs: pickStatements() (at the cursor, a selection, all), runStatements() (a log per
|
|
71
|
+
statement, psql command tags, notices, error line and column), explainStatement() (EXPLAIN / rolled-back ANALYZE)
|
|
72
|
+
tabledef.ts (sprint 95) a table as a definition: readTable(), checkTable(), tableSql() (CREATE, or ALTER from the catalog's version)
|
|
73
|
+
sqlformat.ts (sprint 93) formatSql(): the worksheet's Format (clauses per line, keyword case; strings and comments kept)
|
|
74
|
+
sqlplan.ts (sprint 92) EXPLAIN (FORMAT JSON) as a tree: parsePlan() (self time, slowest step, misestimates), planText()
|
|
70
75
|
quicksql.ts Quick SQL: shorthand parser and PostgreSQL DDL generator (unit tested)
|
|
71
76
|
xlsx.ts Excel writer for report downloads and Unload Data (typed cells, streamed through fflate's Zip)
|
|
72
77
|
automations.ts cron parser, next run in a time zone, scheduler (also meta.task_expire_tick, 094), running automations (the actions run
|
|
@@ -215,8 +220,14 @@ src/
|
|
|
215
220
|
(sprint 86) GET /builder/apps/:app/pages/:no, /builder/pages/:id redirects browsers there (designerUrl in ui.ts)
|
|
216
221
|
errors.ts (sprint 86) the builder's HTML 404 and 500 pages for browsers (wantsHtml, a not-found handler and an onSend hook)
|
|
217
222
|
arrange.ts page designer layout changes: move, column span, create from the gallery, undo / redo
|
|
218
|
-
sql.ts SQL Workshop: the home and
|
|
223
|
+
sql.ts SQL Workshop: the home and the session's schema
|
|
224
|
+
worksheet.ts (sprint 91) the SQL Worksheet (Database Actions' SQL; /sql/commands too): navigator (pickSchema, objects with
|
|
225
|
+
columns, objectStatements), toolbar, output tabs, history (meta.sql_history, 108), plan trees, Run as an app's role, (sprint 93) Save / Rename / Download as SQL Scripts, bind and substitution values, POST /sql/worksheet/format; GET /sql/worksheet/navigator
|
|
219
226
|
object-browser.ts (sprint 75) the Object Browser: objects by type, system objects hidden, a table in tabs, column actions as SQL to review
|
|
227
|
+
table-editor.ts (sprint 95) Table Properties: GET/POST /sql/objects/table (create, edit ?o=, ?template=), fromForm(), Preview / Apply
|
|
228
|
+
(one transaction) / Open in the worksheet
|
|
229
|
+
object-actions.ts (sprint 94) an object's ⋯ menu (objectMenu) in the worksheet and the Object Browser: Quick DDL (objectDdl), Drop with
|
|
230
|
+
dependents, Add index / trigger / policy as drafts; GET /sql/objects/action, /sql/objects/panel (Open in a panel)
|
|
220
231
|
scripts.ts SQL Workshop → SQL Scripts: editor, upload/download, run, results per statement, run history
|
|
221
232
|
quicksql.ts SQL Workshop → Quick SQL page (preview, save as script, run)
|
|
222
233
|
querybuilder.ts SQL Workshop → Query Builder: catalog, joins by foreign key or drawn, functions/group by, buildQuery() from the URL; the canvas is in builder.js
|
|
@@ -279,6 +290,8 @@ public/
|
|
|
279
290
|
app.css theme (light/dark, responsive; --font, --font-size, --radius for style variants; template option classes to-*)
|
|
280
291
|
app.js client runtime: dialogs (dialog_closed actions), popup LOVs, dynamic actions (focus, classes, messages), grids (add/duplicate rows, master-detail refresh, move/resize columns, copy/paste of cell ranges), menus, lazy regions, maps (Leaflet layers, marker clusters, heat layer, layer legend, area/distance filter) (no inline JS)
|
|
281
292
|
code-editor.js, .css builder code editor: enhances <textarea data-code>, highlighting, suggestions (no dependencies)
|
|
293
|
+
worksheet.js, .css (sprint 91) the SQL Worksheet: run keys with the cursor, output tabs, navigator swap and search, drag and drop, splitters;
|
|
294
|
+
(92) grid sort, value dialog, history filter; (93) worksheet tabs in localStorage, Files, binds dialog, format, find, case
|
|
282
295
|
builder.css builder only: IDE look (dark chrome, icon rail, panes), builder light/dark tokens
|
|
283
296
|
builder.js builder only: tabs, component tree, property filter, drag and drop on the layout
|
|
284
297
|
builder-icons.svg builder only: icons of the rail, toolbar and designer (b-*)
|
|
@@ -298,6 +311,10 @@ test/
|
|
|
298
311
|
unload.test.ts Unload Data: CSV/JSON/XLSX/XML output, read back with Load Data, read-only and one-statement checks, streaming
|
|
299
312
|
app-from-file.test.ts Create → From a file: proposed names and types, app + table + rows + pages, row errors, login, validation
|
|
300
313
|
workshop.test.ts SQL scripts, Quick SQL pages, query builder, data load definitions (Load Data, the process, export)
|
|
314
|
+
tabledef.test.ts (sprint 95) table definitions round trip: CREATE, read, ALTER, read again; mistakes
|
|
315
|
+
table-editor.test.ts (sprint 95) the Table Properties page: preview, apply, a failing apply rolls back, template, worksheet
|
|
316
|
+
object-actions.test.ts (sprint 94) object menus: Quick DDL, Drop with dependents, Add index / trigger / policy, the panel, not-found
|
|
317
|
+
worksheet.test.ts (sprint 91) the SQL Worksheet: statement at the cursor, Run Script log, plans, notices, history, navigator, Run as
|
|
301
318
|
quicksql.test.ts Quick SQL parser and DDL generator
|
|
302
319
|
xml.test.ts XML reader: rows, attributes, paths, refused DTDs and entities, limits
|
|
303
320
|
printing.test.ts report PDFs
|
|
@@ -343,6 +360,7 @@ test/
|
|
|
343
360
|
helpers.ts a cookie-keeping test browser
|
|
344
361
|
e2e/responsive.test.ts browser tests at phone/tablet/desktop widths (Playwright)
|
|
345
362
|
e2e/code-editor.test.ts the code editor in a browser: highlighting, keys, suggestions, touch, screen readers
|
|
363
|
+
e2e/worksheet.test.ts (sprint 91) the SQL Worksheet in a browser: run keys, tabs, navigator, drag and drop, splitters, phone, no JavaScript
|
|
346
364
|
e2e/items.test.ts sprint 26 item types in a browser: editors, tags, stars, dates, reveal; without JavaScript
|
|
347
365
|
e2e/designer.test.ts page designer: panes per width, drag and drop, keyboard, Arrange buttons, builder theme
|
|
348
366
|
e2e/calendar.test.ts calendar drag and drop and create on click, view switching, chart drill-down
|
package/docs/guide/16-files.md
CHANGED
|
@@ -265,7 +265,7 @@ parsing, type inference and limits.)
|
|
|
265
265
|
3. The result shows the rows inserted, updated and skipped, with a link to the table in the
|
|
266
266
|
Object Browser.
|
|
267
267
|
|
|
268
|
-
Load Data runs as the builder's owner connection, like SQL
|
|
268
|
+
Load Data runs as the builder's owner connection, like the SQL Worksheet.
|
|
269
269
|
|
|
270
270
|
### SQL Workshop → Unload Data
|
|
271
271
|
|
|
@@ -352,7 +352,7 @@ Rows to develop and test with (APEX 26.1's Data Generator / "sample data for dev
|
|
|
352
352
|
Definitions are shared by the developers of the installation, like SQL scripts, and not part of
|
|
353
353
|
an application export (they describe tables, not an application).
|
|
354
354
|
|
|
355
|
-
Sample Data runs as the builder's owner connection (like SQL
|
|
355
|
+
Sample Data runs as the builder's owner connection (like the SQL Worksheet: triggers run, row level
|
|
356
356
|
security doesn't apply to the owner), on a connection of its own that is closed afterwards, with a
|
|
357
357
|
statement timeout (`SAMPLE_DATA_STATEMENT_TIMEOUT`, default `5min`) and at most
|
|
358
358
|
`SAMPLE_DATA_MAX_ROWS` rows per run (default 100,000). Table and column names come from the
|