Skip to content
Merged
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
30 changes: 28 additions & 2 deletions docs/src/main/sphinx/sql/alter-table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ The optional ``IF EXISTS`` (when used before the column name) clause causes the

The optional ``IF NOT EXISTS`` clause causes the error to be suppressed if the column already exists.

.. _alter-table-set-properties:

SET PROPERTIES
^^^^^^^^^^^^^^

The ``ALTER TABLE SET PROPERTIES`` statement followed by some number
of ``property_name`` and ``expression`` pairs applies the specified properties
and values to a table. Ommitting an already-set property from this
statement leaves that property unchanged in the table.

A property in a ``SET PROPERTIES`` statement can be set to ``DEFAULT``, which
reverts its value back to the default in that table.
Comment thread
jhlodin marked this conversation as resolved.
Outdated

Support for ``ALTER TABLE SET PROPERTIES`` varies between
connectors, as not all connectors support modifying table properties.

.. _alter-table-execute:

EXECUTE
Expand Down Expand Up @@ -87,9 +103,19 @@ Allow everyone with role public to drop and alter table ``people``::

ALTER TABLE people SET AUTHORIZATION ROLE PUBLIC
Copy link
Copy Markdown
Member

@Ordinant Ordinant Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interaction between pure SQL role granting and access control role granting is ... unexplored.

Copy link
Copy Markdown
Contributor Author

@jhlodin jhlodin Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, but ultimately out of scope for this PR. If someone has input then I can file a follow-up issue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ordinant Do you mean using things like file-based access control together with SQL based access control?

If so such a configuration can never be possible since Trino only allows a single type of system access control to be available at a time.

However connectors may provide their own - and the rule there is that system level configuration wins over connector specific ones.


Set table properties (``x=y``) to table ``users``::
Set table properties (``x = y``) in table ``people``::

ALTER TABLE people SET PROPERTIES x = 'y';

Set multiple table properties (``foo = 123`` and ``foo bar = 456``) in
table ``people``::

ALTER TABLE people SET PROPERTIES foo = 123, "foo bar" = 456;

Set table property ``x`` to its default value in table``people``::

ALTER TABLE people SET PROPERTIES x = DEFAULT;

ALTER TABLE people SET PROPERTIES x = 'y'

Collapse files in a table that are over 10 megabytes in size, as supported by
the Hive connector::
Expand Down