Problem with array syntax

From: Web Manager <web(at)inter-resa(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Problem with array syntax
Date: 2000-01-11 20:29:11
Message-ID: 387B9297.1714E5D2@inter-resa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello!

Since I am new at this and that my self testing is not working, can
someone help me with the syntax of creating an array and the way to
insert data in it?

In a tourism context, let's say that an hotel has 2 room type. I want a
2 month room availability table for each days... say 3 days for this
example!

The matrix would look like:

room_type 1 1 2 2
month 1 2 1 2
day1 3 4 2 4
day2 3 5 0 0
day3 0 2 1 2

where room_type is 1 or 2
where month is 1 or 2
where dayX is the day's number. So for the room_type 2, the 3rd day of
the 2sd month gives me "2" room availability.

would some thing like:
create table test (hotel_id varchar(8),type_ch int2[],mois int2[],jour
int2[]);

be ok?

How can I insert values so the array will allow me to scan a precice
position:

room type 1, first month, first day (= 3)

Thanks a lot!!!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marc Andre Paquin

Browse pgsql-sql by date

  From Date Subject
Next Message Web Manager 2000-01-11 21:00:45 Problem with array syntax
Previous Message Tom Lane 2000-01-11 16:14:35 Re: [SQL] best strategy doing a large copy and using indexes