Skip to content
On this page

@comment

SQL comments for Postgres tables, columns, and other schema objects

Postgres

Example

Describe a table and column

Emits dialect-specific comment statements.

Input SQL
sql
-- @comment('Primary user accounts table')
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  -- @comment('User email address, must be unique')
  email TEXT NOT NULL UNIQUE
);
Compiled Output
sql
COMMENT ON TABLE "users" IS 'Primary user accounts table';
COMMENT ON COLUMN "users"."email" IS 'User email address, must be unique';

Tags

@comment

Add a COMMENT ON statement to a table, column, view, function, type, or index

Targets: table, column, view, function, type, index

Arguments:Positional: string