Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion databases/postgresql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ A `CREATE INDEX CONCURRENTLY` or `REINDEX CONCURRENTLY` that fails or is cancell

## Cross-database tabs

PostgreSQL has no in-place `USE`, so every database browsed from the [connections strip](/features/workspace-rail) gets a server connection of its own. Moving between two database entries switches between those connections without reconnecting, and each keeps its open transaction, temp tables, and `SET` values until its entry is closed or the connection ends. Closing the entry or the connection, or disconnecting, asks first when that rolls back an open transaction. A tab runs on the connection of the database it is bound to.
PostgreSQL has no in-place `USE`, so every database browsed from the [connections strip](/features/workspace-rail) gets a server connection of its own. Moving between two database entries switches between those connections without reconnecting, and each keeps its open transaction, temp tables, and `SET` values until its entry is closed or the connection ends. Closing the entry or the connection, or disconnecting, asks first when a transaction is open there, and **Commit** commits it before the connection closes. A tab runs on the connection of the database it is bound to.

A tab bound to a database that has no entry runs on a [metadata connection](/connections/connection-form#connection-health) instead. That one is shared with the Structure tab and closes after 10 minutes idle, so open the database from the strip before starting a transaction or a `CREATE TEMP TABLE` there. A database connection that died while idle is reopened on its next use; if it held a transaction, that statement is refused once with a message saying the server rolled it back. Binding itself is on [Tabs](/features/tabs#where-a-tab-points).

Expand Down
15 changes: 13 additions & 2 deletions databases/teradata.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,24 @@ teradata://user:password@host:1025/database

## Databases and objects

A database and a user are both namespaces in Teradata, and both appear as top-level databases in the sidebar with their tables and views inside. A tab bound to a second database keeps the same session: `DATABASE "name"` runs ahead of its statements instead of a reconnect. The switch is refused while a transaction is open, because Teradata takes nothing but `COMMIT` or `ET` after `DATABASE` inside one.
A database and a user are both namespaces in Teradata, and both appear as top-level databases in the sidebar with their tables and views inside. A tab bound to a second database keeps the same session: `DATABASE "name"` runs ahead of its statements instead of a reconnect. A switch to another database is refused while a transaction is open, because Teradata takes nothing but `COMMIT` or `ET` after `DATABASE` inside one. **Truncate** runs `DELETE FROM name ALL`.

Identifiers are quoted with double quotes. Teradata has no `LIMIT`, so a table's first page comes back with `TOP` and later pages with `QUALIFY ROW_NUMBER()`.

## Stopping a query

**Stop** keeps the session. A statement still running is aborted, and Teradata rolls back the transaction it ran in. With **Transaction Mode** set to `ANSI`, that is every change since the last `COMMIT`, and the tab says so. In `TERA` mode it is the statement alone, or every change since `BT` when one is open. On `DEFAULT` and `TERA` the tab shows no notice, even on a system that runs ANSI by default. A result already coming back is cut where it is, and nothing is rolled back.

## Transactions

In an `ANSI` session every statement joins one transaction, which only `COMMIT` or `ROLLBACK` ends, and a DDL statement has to be the last in it. While it holds changes, the transaction bar above the tabs offers **Commit** and **Roll Back**.

- A structure save, **Create Table**, a comment, a rename, a sidebar drop and the new table of an import commit each statement as it runs. On the session that runs your queries they are refused while a transaction is open there: commit or roll it back first.
- **Run All** stops after a DDL statement while a transaction is open, unless the next statement is `COMMIT`, `ROLLBACK`, `ABORT` or `ET`. What ran stays in the transaction. Click **Commit** in the transaction bar, then run the rest.
- A `DATABASE` statement in **Run All** is committed as it runs when nothing else is pending, so the rest of the script runs there. While a transaction is open, the run stops before it: commit or roll back, then run the script again from that statement. A new run starts in the tab's database.
- Startup commands are committed once they have run.
- In `TERA` mode a statement outside `BT` commits on its own. Inside `BT`, **Run All** stops after DDL the same way, because any statement but `ET` there rolls back the whole block: commit, then begin the rest with `BT`. A script that holds `BT` runs as written, with no transaction of the app's own around it.

## SSL/TLS

| Mode | What happens |
Expand All @@ -71,7 +81,8 @@ Test TLS on **Required (skip verify)** rather than **Preferred**, or a failed ha
- LDAP, Kerberos, and JWT logon fail before the connect is attempted. Use `TD2` or `TDNEGO`.
- The TLS port is fixed at `443`.
- A `NUMBER`, `BLOB`, `CLOB`, `JSON`, `XML` or `PERIOD` column cannot be read yet. `CAST` it to `DECIMAL` or `VARCHAR` in the query.
- **Run All** runs a script that holds a `CREATE`, `ALTER`, `DROP` or other DDL statement one statement at a time, with no transaction around it, because Teradata accepts nothing after DDL inside a transaction. In an `ANSI` session the script still needs a `COMMIT` after each DDL statement, and DDL the structure editor runs stays uncommitted until you commit.
- A structure save with several changes commits them one at a time, so a change that fails leaves the ones before it in place. Check the Structure tab and save the rest again.
- With **Transaction Mode** on `DEFAULT` and a session whose mode `HELP SESSION` and `DBC.SessionInfoV` could not report, nothing is committed for you after DDL and **Run All** does not stop. Set the mode to `ANSI` or `TERA` to match the system.

## Troubleshooting

Expand Down
16 changes: 13 additions & 3 deletions features/connection-window.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,22 @@ Quit, **Relaunch to Update**, closing a window, a connection or a tab, and Disco
- an agent reply, including one waiting for your answer
- a comparison or a sync script in Compare & Sync

**Quit Anyway**, **Relaunch Anyway**, **Close Anyway** or **Disconnect Anyway** stops each item on the list. **Cancel**, or Escape, keeps everything running. Quitting lists unsaved tabs and open transactions on the same alert, and closing or disconnecting lists an open transaction there. When you close a window or a connection, unsaved edits still get **Do you want to save changes?** after it.

With nothing running, a quit or a relaunch still asks while a transaction is open: **Quit with an Open Transaction?** names each connection whose uncommitted changes the server rolls back, and adds unsaved tabs when there are any.
**Quit Anyway**, **Relaunch Anyway**, **Close Anyway** or **Disconnect Anyway** stops each item on the list once every question is answered. **Cancel**, or Escape, keeps everything running. Quitting lists unsaved tabs on the same alert. When you close a window or a connection, unsaved edits still get **Do you want to save changes?** after it.

A stopped restore can leave the database partly restored, and a stopped sync script keeps the statements it already ran.

## Open transactions

Closing a window, a connection or a database entry, Disconnect, Quit and **Relaunch to Update** end the session that holds a transaction, so they ask about it last, after running work and unsaved edits, for example **Do you want to commit the open transaction before disconnecting from “name”?**

| Button | Result |
| --- | --- |
| **Commit**, the default | Commits each open transaction, then goes on |
| **Cancel**, or Escape | Keeps everything open |
| **Roll Back** | Goes on, and the server rolls the transaction back |

**Commit** asks what the transaction bar's **Commit** asks at your [Safe Mode](/features/safe-mode) level. If it fails, the window, connection or app stays open and shows the error. Under Manual Commit, edits saved from **Do you want to save changes?** are part of the transaction. When the transaction can only be rolled back, because a statement in it failed, the connection is **Read-Only**, or a statement is still running in it, the alert offers only **Close**, **Disconnect**, **Quit Anyway** or **Relaunch Anyway**, and **Cancel**.

## Related

- [Query Tabs](/features/tabs) for the strip under the toolbar and what a tab is bound to
Expand Down
2 changes: 1 addition & 1 deletion features/sql-editor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ While a session holds a transaction, a bar above every tab of the connection say

Commit and Roll Back act on the connection the bar names. When other work ran there after you clicked, they do nothing and say so: check the transaction and try again.

The server rolls back what a session leaves open, so quitting or relaunching to update asks first while a transaction is open. See [Work still running](/features/connection-window#work-still-running).
The server rolls back what a session leaves open, so closing, disconnecting, quitting and relaunching to update ask first while a transaction is open, with **Commit** as the default. See [Open transactions](/features/connection-window#open-transactions).

### Manual Commit

Expand Down
2 changes: 1 addition & 1 deletion features/workspace-rail.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Each entry keeps its own tabs. Clicking one shows its tabs and returns you to th

Moving between schemas inside one database, such as PostgreSQL's, keeps the entry and its tabs. Tables of the same name in two schemas are told apart by their schema-qualified tab titles.

On PostgreSQL, Redshift, and CockroachDB every database entry keeps its own server connection, so moving between two entries reconnects nothing and leaves each database's open transaction and temp tables where they were. Closing an entry closes its connection and rolls back a transaction still open there, so it asks first when there is one. A badge on the corner of the entry's icon marks a transaction: an orange hourglass while one is open, a red warning triangle once a statement in it failed and only a rollback is left. On other engines the badge marks every entry of the connection, since one connection holds the transaction for all of them.
On PostgreSQL, Redshift, and CockroachDB every database entry keeps its own server connection, so moving between two entries reconnects nothing and leaves each database's open transaction and temp tables where they were. Closing an entry closes its connection and rolls back a transaction still open there, so it asks first when there is one, with **Commit**, **Roll Back** and **Cancel**. A badge on the corner of the entry's icon marks a transaction: an orange hourglass while one is open, a red warning triangle once a statement in it failed and only a rollback is left. On other engines the badge marks every entry of the connection, since one connection holds the transaction for all of them.

The strip takes the keyboard too. Click into it, then use the arrow keys to move the highlight. Type the start of a connection, database, or schema name to jump to it, and press `Return` to open the entry.

Expand Down
Loading