Thread: How to insert data to a table with datarange data type?

How to insert data to a table with datarange data type?

From
Csanyi Pal
Date:
Hi,

I just installed postgresql 9.2 and PgAdmin3 version 1.16.1 on my Debian
Wheezy system.

I have a database and in it a table with one column 'date' that is
daterange type.

When I want to add the first date into that table I get error message:
An error has occurred:

ERROR:  array value must start with "{" or dimension information
LINE 1: ...félévek_negyedévek".felev_2_napjai(datum) VALUES
('2013.03.0...

An error has occurred:

ERROR:  array value must start with "{" or dimension information
LINE 1: ...félévek_negyedévek".felev_2_napjai(datum) VALUES
('2013.03.0... 

What is the proper way to instert a date into this table?

-- 
Regards from Pal




Re: How to insert data to a table with datarange data type?

From
Jeff Janes
Date:
On Sat, Mar 9, 2013 at 12:43 PM, Csanyi Pal <csanyipal@gmail.com> wrote:
Hi,

I just installed postgresql 9.2 and PgAdmin3 version 1.16.1 on my Debian
Wheezy system.

I have a database and in it a table with one column 'date' that is
daterange type.

When I want to add the first date into that table I get error message:
An error has occurred:

ERROR:  array value must start with "{" or dimension information
LINE 1: ...félévek_negyedévek".felev_2_napjai(datum) VALUES
('2013.03.0...

It looks like you may have declared your column to be of type daterange[], not type daterange.

That is, an array of dateranges, not a simple daterange.

Cheers,

Jeff