Q:

How to insert tsrange using perl

Using DBD::Pg im attempting to make an insert statement with binded variables which one of them is a tsrange. I keep getting syntax errors can some one please explain the proper way to do this?
from perl script :
$sth->{'insert'}->execute($hashRef->{'<NUMBER>'}
                                    , $hashRef->{'<FIRSTNAME>'}
                                    , $hashRef->{'<LASTNAME>'}
                                    , $hashRef->{'<DATEIN>'} . ' ' .       $hashRef->{'<TIMEIN>'}
                                    , $hashRef->{'<DATEOUT>'} . ' ' .  $hashRef->{'<TIMEOUT>'}
                                    , $hashRef->{'<JOBCODE>'} 
                                    , $hashRef->{'<JOBCODEDESC>'} 
                                    , $hashRef->{'<COSTCODELEVEL1>'} 
                                    , $hashRef->{'<COSTCODELEVEL2>'} 
                                    , $hashRef->{'<COSTCODELEVEL3>'} 
                                    , $hashRef->{'<DEPARTMENT>'} 
            )or die $DBI::errstr;
    enter code here 

from config file:
sql:
    insert: |-
        insert into etl.timeclock_plus values (
           ? 
         , ? 
         , ?  
         , [ ? , ? ] 
         , ? 
         , ? 
         , ? 
         , ? 
         , ?
         , ? 
        )   
The error : 
syntax error at or near "$4"

A:

Instead of
[ $1, $2 ]

which is invalid SQL, use a range constructor function:
tstzrange($1, $2, '[)')

There is also tsrange and daterange if you need those data types.

