Skip to content
Written with Claude
IMPORTANT

As you may notice, this page and pretty much the entire website were obviously created with the help of AI. I wonder how you could tell? Was it a big "Written With Claude" badge on every page? I moved it to the top now (with the help of AI of course) to make it even more obvious. There are a few blogposts that were written by me manually, the old-fashioned way, I hope there will be more in the future, and those have a similar "Human Written" badge. This project (not the website), on the other hand, is a very, very different story. It took me more than two years of painstaking and unpaid work in my own free time. A story that, hopefully, I will tell someday. But meanwhile, what would you like me to do? To create a complex documentation website with a bunch of highly technical articles with the help of AI and fake it, to give you an illusion that I also did that manually? Like the half of itnernet is doing at this point? How does that makes any sense? Is that even fair to you? Or maybe to create this website manually, the old-fashioned way, just for you? While working a paid job for a salary, most of you wouldn't even get up in the morning. Would you like me to sing you a song while we're at it? For your personal entertainment? Seriously, get a grip. Do you find this information less valuable because of the way this website was created? I give my best to fix it to keep the information as accurate as possible, and I think it is very accurate at this point. If you find some mistakes, inaccurancies or problems, there is a comment section at the bottom of every page, which I also made with the help of the AI. And I woould very much appreciate if you leave your feedback there. Look, I'm just a guy who likes SQL, that's all. If you don't approve of how this website was constructed and the use of AI tools, I suggest closing this page and never wever coming back. And good riddance. And I would ban your access if I could know how. Thank you for your attention to this matter.

DISABLED

Disable endpoint globally or conditionally based on tags.

Overview

This annotation prevents an endpoint from being created. Use it to:

  • Completely disable an endpoint
  • Conditionally disable an endpoint based on routine volatility or CRUD operation type
  • Hide internal functions that shouldn't be exposed as HTTP endpoints
  • Control which CRUD operations are exposed for tables and views

Tags are automatically assigned based on routine source (function volatility, CRUD operation type). See TAGS for the complete list of automatic tags.

This annotation is particularly useful with automatic CRUD endpoint generation to control which operations are exposed for tables and views.

Keywords

@disabled, disabled

Syntax

@disabled
@disabled <tag1>, <tag2>, <tag3>, ...

Space-separated lists are also valid: @disabled insert update delete

  • Without tags: Disables the endpoint unconditionally
  • With tags: Disables the endpoint only when it has at least one of the specified tags

Understanding disabled with Tags

When you use disabled with tags, it only disables endpoints that have at least one of the specified tags:

sql
-- Disable only INSERT operations (all variants)
@disabled insert

-- Disable only RETURNING variants (insert_returning, update_returning, delete_returning)
@disabled returning

-- Disable only ON CONFLICT variants (upsert operations)
@disabled on_conflict

-- Disable multiple operation types
@disabled insert, update, delete

Tag Hierarchy for CRUD Operations

Tags are hierarchical - broader tags match multiple operations:

TagMatches
returninginsert_returning, update_returning, delete_returning, on_conflict_do_nothing_returning, on_conflict_do_update_returning
on_conflicton_conflict_do_nothing, on_conflict_do_update (and their returning variants)
insertinsert, insert_returning, all on_conflict variants
updateupdate, update_returning
deletedelete, delete_returning

Examples

Disable Globally

sql
comment on function deprecated_func() is
'HTTP
@disabled';

The function will not be exposed as an HTTP endpoint.

Disable Volatile Functions

sql
-- Disable endpoint for volatile functions (side effects)
comment on function dangerous_operation() is
'HTTP POST
@disabled volatile';

Disable Write Operations on a Table

sql
-- Make table read-only via API
comment on table reference_data is
'@disabled insert, update, delete';

This disables INSERT, UPDATE, and DELETE endpoints, keeping only SELECT.

Disable for Production

sql
comment on function admin_debug() is
'HTTP
@disabled production';

Endpoint is disabled when the routine has production tag but available in other environments.

Selective Disable with Re-enable

sql
comment on function internal_api() is
'HTTP GET
@disabled
@enabled immutable';

Disables by default, but re-enables for immutable functions only.

Disable Returning Variants

sql
-- Disable all RETURNING variants for simpler API
comment on table orders is
'@disabled returning';

This disables all CRUD operations that return data (insert returning, update returning, delete returning).

CRUD Endpoint Control

When using CRUD source with "CommentsMode": "ParseAll", you can use disabled and enabled annotations together to precisely control which CRUD operations are exposed.

Disable All, Enable Specific Operations

sql
create table crud_select_only (
    id int primary key,
    name text
);

comment on table crud_select_only is '
@disabled
@enabled select, delete
';

This table will only have SELECT and DELETE endpoints. All other operations (INSERT, UPDATE, and their variants) return 405 Method Not Allowed.

Disable Specific Operation Groups Using Tags

sql
create table crud_commented_table (
    id int primary key,
    name text
);

comment on table crud_commented_table is '
for returning
@disabled
for insert_on_conflict_do_update, insert_on_conflict_do_nothing
@disabled
';

This disables:

  • All RETURNING variants (insert returning, update returning, delete returning)
  • All ON CONFLICT operations (upsert variants)

Disable All, Enable Only ON CONFLICT Operations

sql
create table crud_on_conflict_only (
    id int primary key,
    name text
);

comment on table crud_on_conflict_only is '
HTTP
@disabled
for on_conflict
@enabled
';

This disables all standard CRUD endpoints but enables only the ON CONFLICT variants (upsert operations).

Real-World Use Cases

Read-Only API Table

Expose data for reading but prevent any modifications:

sql
comment on table reference_data is '
@disabled insert, update, delete
';

Only GET /api/reference-data/ works. All write operations return 405 Method Not Allowed.

Audit Log (Append-Only)

Allow inserting audit records but prevent updates and deletes:

sql
comment on table audit_log is '
@disabled update, delete
';

Simplified API (No RETURNING Variants)

Keep the API surface small by disabling RETURNING endpoints:

sql
comment on table orders is '
@disabled returning
';

This removes /api/orders/returning/ endpoints, clients use standard endpoints and fetch data separately if needed.

Upsert-Only Table (Idempotent API)

For idempotent APIs where clients should only use upsert:

sql
comment on table sync_state is '
@disabled
for on_conflict
@enabled
';

Only PUT /api/sync-state/on-conflict-do-update/ works - perfect for sync/state endpoints.

Behavior

  • When used without tags, unconditionally disables the endpoint
  • When used with tags, disables only if the endpoint has at least one matching tag
  • Can be combined with enabled to create complex enable/disable logic
  • Tags include automatic tags from routine source (volatility, CRUD type) and custom tags
  • Case-insensitive tag matching
  • Comma-separated tags work the same as space-separated: disabled insert, update equals disabled insert update
  • ENABLED - Enable endpoint globally or by tags
  • TAGS - Automatic tags and conditional annotation application

Comments

Released under the MIT License.