Re: Function inserting into tstzrange ? (syntax error at or near...)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
Cc: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Function inserting into tstzrange ? (syntax error at or near...)
Date: 2024-02-18 17:52:59
Message-ID: 3883445.1708278779@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> writes:
> I'm sure I'm doing something stupid here, but I think I've got the syntax right ?
> The error I'm seeing:
> psql:event_session_funcs.sql:26: ERROR:  syntax error at or near "["
> LINE 11:         VALUES(p_event_id,[p_start_time,p_end_time)) RETURNI...

There's not bespoke SQL syntax for constructing a range. You must
use a function, something like

VALUES(p_event_id, tstzrange(p_start_time,p_end_time,'[)')) ...

although I believe '[)' is the default bounds type so that could be
simplified to

VALUES(p_event_id, tstzrange(p_start_time,p_end_time)) ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2024-02-18 18:30:20 Re: Function inserting into tstzrange ? (syntax error at or near...)
Previous Message Adrian Klaver 2024-02-18 17:49:36 Re: Function inserting into tstzrange ? (syntax error at or near...)