Re: Function inserting into tstzrange ? (syntax error at or near...) - Mailing list pgsql-general

From Laura Smith
Subject Re: Function inserting into tstzrange ? (syntax error at or near...)
Date
Msg-id 2nqXMmBAg_UsRbjwNzuT1pU8YZwfkxPEdD-dTlTloMylGJP_99629l9bZEpUrXIoOM-SmnvWNk9fCwBMq7-5zk1au04wAh790LINW36_Zmc=@protonmail.ch
Whole thread Raw
In response to Re: Function inserting into tstzrange ? (syntax error at or near...)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Function inserting into tstzrange ? (syntax error at or near...)
List 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
justmimic 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.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Function inserting into tstzrange ? (syntax error at or near...)
Next
From: Dominique Devienne
Date:
Subject: Re: Users and object privileges maintenance