© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
22 replies
Solomon Shalom Lijo

SQL Syntax Error - error at or near end

Can someone help me find the error? I am a little confused -

CREATE TYPE expires AS ENUM (
    'never',
    '1h',
    '2h',
    '10h',
    '1d',
    '2d',
    '1w',
    '1m',
    '1y'
);
CREATE TABLE snips (
    id varchar(255) PRIMARY KEY,
    code TEXT NOT NULL,
    password TEXT,
    language TEXT,
    expires_in expires,
    created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    user_id UUID,
    CONSTRAINT user FOREIGN KEY(user_id) REFERENCES user(id)
)
CREATE TYPE expires AS ENUM (
    'never',
    '1h',
    '2h',
    '10h',
    '1d',
    '2d',
    '1w',
    '1m',
    '1y'
);
CREATE TABLE snips (
    id varchar(255) PRIMARY KEY,
    code TEXT NOT NULL,
    password TEXT,
    language TEXT,
    expires_in expires,
    created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    user_id UUID,
    CONSTRAINT user FOREIGN KEY(user_id) REFERENCES user(id)
)


By running it, it's showing up an error as
Failed to validate sql query: syntax error at or near "user"
Failed to validate sql query: syntax error at or near "user"


Can someone help me resolve this issue?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Failed to run sql query syntax error at or near end
SupabaseSSupabase / help-and-questions
4y ago
syntax error at or near boolean
SupabaseSSupabase / help-and-questions
4y ago
RLS Policy syntax error at or near "create"
SupabaseSSupabase / help-and-questions
3y ago
[BUG]:PostgresError: syntax error at or near "NOT"
SupabaseSSupabase / help-and-questions
3mo ago