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

From: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
To: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Function inserting into tstzrange ? (syntax error at or near...)
Date: 2024-02-18 18:30:20
Message-ID: 2nqXMmBAg_UsRbjwNzuT1pU8YZwfkxPEdD-dTlTloMylGJP_99629l9bZEpUrXIoOM-SmnvWNk9fCwBMq7-5zk1au04wAh790LINW36_Zmc=@protonmail.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
> 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,'[)')) ...

Thanks all for your swift replies.

Serves me right for assuming I could use variable substitution where text would normally go, i.e. I thought I could just mimic the below example from the docs by substituting the variables:

INSERT INTO reservation VALUES
(1108, '[2010-01-01 14:30, 2010-01-01 15:30)');

Lesson learnt !

Thanks again.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2024-02-18 18:35:00 Re: Users and object privileges maintenance
Previous Message Tom Lane 2024-02-18 17:52:59 Re: Function inserting into tstzrange ? (syntax error at or near...)