Views, Functions, and Procedures
Editing a definition and its properties.
Select a view, function, or procedure in the primary sidebar and switch to Structure to edit its definition, with its properties in a sidebar beside it.
Views #
The Definition section holds the view's SELECT, with the same syntax coloring, completion, and formatting commands as the query editor. Saving redefines the view in place, so dependent objects and privileges survive. There's no undo, so copy the original definition first if the change is large.
The View Info sidebar holds everything that isn't part of the SELECT:
| Property | Meaning |
|---|---|
| Definer, Owner | The user the view is attributed to. |
| Security Type — Definer or Invoker | Whose privileges apply when the view is queried. A definer-rights view can read tables the caller can't, which is both its use and its risk. It also explains results you can't reproduce with a direct query. |
| Algorithm — Merge, Temptable, Undefined | How MySQL evaluates the view. Temptable materializes it and prevents merging it into the outer query. |
| Check Option — Cascaded, Local, None | Validates writes through the view against its WHERE clause. |
| Updatable | Whether rows can be written through the view. |
| Security Barrier, Security Invoker | PostgreSQL view options controlling how the planner may push conditions into the view. |
On servers that support indexes on views, they appear in their own section.
Functions and Procedures #
The Definition section holds the routine's body. The Routine Info sidebar shows:
| Property | Meaning |
|---|---|
| Definer, Owner, Security Type | As for views: whose privileges the routine runs with. |
| Return Type | Functions only. |
| Language | The language of the body. PostgreSQL routines are often not SQL. |
| Deterministic | Whether the same arguments always give the same result. MySQL relies on this for replication and the query cache. |
| SQL Data Access — Contains SQL, No SQL, Reads SQL Data, Modifies SQL Data | What the routine does to data. It's declared, not verified, so a wrong value won't stop the routine but will mislead the server. |
| Volatility — Immutable, Stable, Volatile | The PostgreSQL equivalent. An IMMUTABLE function can be folded into a constant and used in an index expression. |
| Parallel, Strict | PostgreSQL properties for parallel execution and null handling. |
| SQL Mode | The SQL mode in effect when the routine was created, which continues to apply when it runs. |
| Created, Last Altered | Timestamps. The quickest way to see whether the routine changed recently. |
To compare a routine against another environment's copy, use a database comparison with only Compare Functions and Compare Procedures checked.