Skip to content

added enable and disable trigger to alter table#23217

Open
peachdawnleach wants to merge 2 commits intomainfrom
20260423-doc-16053-enable-disable-trigger
Open

added enable and disable trigger to alter table#23217
peachdawnleach wants to merge 2 commits intomainfrom
20260423-doc-16053-enable-disable-trigger

Conversation

@peachdawnleach
Copy link
Copy Markdown
Contributor

Fixes: DOC-16053 and DOC-11412

Adds ENABLE TRIGGER and DISABLE TRIGGER to ALTER TABLE

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit a9e71b9
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-api-docs/deploys/69ea82603d7cfc0008896b20

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit a9e71b9
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-interactivetutorials-docs/deploys/69ea82605308be0008ad0897

@github-actions
Copy link
Copy Markdown

Files changed:

@peachdawnleach peachdawnleach requested a review from rafiss April 23, 2026 20:36
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Netlify Preview

Name Link
🔨 Latest commit e59e0dc
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/69ea81cd1aa36a0008a9ccee
😎 Deploy Preview https://deploy-preview-23217--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Netlify Preview

Name Link
🔨 Latest commit a9e71b9
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/69ea82604426eb0008eca0d7
😎 Deploy Preview https://deploy-preview-23217--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

lgtm! thanks for adding this

@mikeCRL mikeCRL self-requested a review April 24, 2026 19:28
Copy link
Copy Markdown
Contributor

@mikeCRL mikeCRL left a comment

Choose a reason for hiding this comment

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

Looks good. A couple suggestions.

Comment on lines +506 to +514
### `ENABLE TRIGGER`

This statement enables a [trigger]({% link {{ page.version.version }}/triggers.md %}) associated with a table. When a trigger is enabled for a table, it activates if its triggering event occurs on the table. Use `ENABLE TRIGGER ALL` or `ENABLE TRIGGER USER` to enable all triggers associated with a table.

For examples, refer to [Enable a trigger](#enable-a-trigger).

### `DISABLE TRIGGER`

This statement disables a [trigger]({% link {{ page.version.version }}/triggers.md %}) associated with a table. When a trigger is disabled for a table, it does not activate even if its triggering event occurs on the table. Use `DISABLE TRIGGER ALL` or `DISABLE TRIGGER USER` to disable all triggers associated with a table.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think readers will wonder what the difference is between DISABLE TRIGGER ALL and DISABLE TRIGGER USER.

I found the answer from the implementation PR (#161924).

In case it helps (maybe you were already aware!) in CockroachDB, ALL and USER do the exact same thing. These are both present for compatibility with PostgreSQL, which distinguishes between system and user triggers. In CRDB, both affect all triggers on the table, since we don't have system triggers.

Consider a callout like this?

ALL and USER are both available for compatibility with PostgreSQL syntax, though in CockroachDB they behave identically. (CockroachDB does not have system triggers.) Both keywords will enable/disable all triggers associated with the table.

I would probably include this again under Enable a trigger, so that users who end up there first will also see it.

Comment on lines +3435 to +3439

{% include_cached copy-clipboard.html %}
~~~ sql
ALTER TABLE <table_name> ENABLE TRIGGER <trigger_name>;
~~~
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% include_cached copy-clipboard.html %}
~~~ sql
ALTER TABLE <table_name> ENABLE TRIGGER <trigger_name>;
~~~
{% include_cached copy-clipboard.html %}
~~~ sql
ALTER TABLE <table_name> ENABLE TRIGGER <trigger_name>;
~~~
This requires an existing trigger. For information on creating a trigger, refer to [Triggers]({% link {{ page.version.version }}/triggers.md %}).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Realized this was implied throughout the updates but never explicit. One option for your consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants