Re: How to enter daterange into a raw? - SOLVED

From: Csanyi Pal <csanyipal(at)gmail(dot)com>
To: pgadmin-support(at)postgresql(dot)org
Subject: Re: How to enter daterange into a raw? - SOLVED
Date: 2013-08-01 08:28:25
Message-ID: 20130801082825.GA25695@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On Wed, Jul 31,Hi David,

2013 at 02:36:23PM -0700, David Johnston wrote:
> Csanyi Pal wrote
> > Hi,
> >
> > I have installed PostgreSQL 9.2 on my desktop machine, and
> > pgAdmin III version: 1.16.1.
> >
> > I'm being creating a new database with daterange type.
> >
> > When I'm trying to enter in the 'Edit Data - PostgreSQL' window in the
> > first raw a range of data:
> >
> > '2013-09-01, 2013-11-01' without quotes, I get error message:
> > ERROR: array value must start with "{" or dimension information
> > LINE 1: INSERT INTO public.negyedev(ettol_eddig) VALUES ('2013-09-01...
> > ^
> > I want inclusive start and end bounds.
> >
> > Well, I dont know how to enter the start data and the end data of the
> > range in pgAdmin III?
>
> Not tested with pgAdmin but I would presume entering a valid literal - as
> defined here:
>
> http://www.postgresql.org/docs/9.2/interactive/rangetypes.html#RANGETYPES-IO
>
> should work.
>
> Namely you have to tell it what kind of bound you desire by inputting "( or
> [" and ") or ]".

It works now. See bellow my mistake, why didn't work earlier.

> No idea why it is trying to convert it to an array though. Are you positive
> you defined the table correctly?

My mistake was that, that I set the column in the table as 'daterange[]'
which is an array of dateranges.

When I set it to 'daterange', then I can to enter a daterange value into
raw of tha table.

> Maybe you should provide the table definition you are trying to use as
> well.

Now, when it works, the table definition is:

-- Table: negyedev

-- DROP TABLE negyedev;

CREATE TABLE negyedev
(
sorsz serial NOT NULL, -- A negyedév sorszáma.
ettol_eddig daterange, -- A negyedév ettől a dátumtól eddig a dátumig
tart....
CONSTRAINT negyedev_pkey PRIMARY KEY (sorsz)
)
WITH (
OIDS=FALSE
);
ALTER TABLE negyedev
OWNER TO postgres;
COMMENT ON TABLE negyedev
IS 'Ez a tábla az iskola négy negyedévének sorszámát, kezdő és
befejező dátumát őrzi.';
COMMENT ON COLUMN negyedev.sorsz IS 'A negyedév sorszáma.';
COMMENT ON COLUMN negyedev.ettol_eddig IS 'A negyedév ettől a dátumtól
eddig a dátumig tart.
A kezdő és a befejező dátum is a negyedévbe tartozik.';

> You may also want to write a simple "INSERT INTO table VALUES ('')" to
> make sure you understand what is happening without involving pgAdmin.

I tried that also when I did searching the solution.

Now, I don't understand, why changes pgAdminIII the entered value,
namely from
[2013-09-01,2013-11-12]

to

[2013-09-01,2013-11-12)

automatically??

I want to enter [2013-09-01,2013-11-12] because I want to to set this
range with inclusive bounds.

--
Regards from Pal

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Jan-Peter Seifert 2013-08-01 11:13:35 Re: PgAdmin V 1.16.1 Error - Comment on database
Previous Message Oli Noname 2013-08-01 06:40:08 Re: PgAdmin V 1.16.1 Error - Comment on database