Re: Using complex PRIMARY KEY

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using complex PRIMARY KEY
Date: 2009-10-08 05:31:51
Message-ID: 20091008053150.GA26647@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to Zsolt :
>
> This is our first project using PostgerSQL, where I have a problem I cant solve
> on a neat way (I assume PGSQL should provide a nice solution...).
>
> So we have an old xBase based program we are trying to port to PostgreSQL while
> we should keep the original data structure especially the ID fields must be
> kept as this IDs are already used in other systems.
>
> The problem is with two table, one is storing the data of houses the other the
> data of tenants in a given houses.
>
>
>
> For a given house I would like to start the numbering of tenants from 1. Each
> house could have tenant_ID=1, obviously in this case the house_ID will differ.
> The combination of tenant_ID and house_ID will be the unique identifier of each
> tenant.

Do you have PostgreSQL 8.4?

If yes, you can use CTE-functions for that. row_number().

Unfortunately, at the moment i haven't access to my database to create
an example, maybe later.

Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gurjeet Singh 2009-10-08 07:32:30 Re: Using complex PRIMARY KEY
Previous Message paresh masani 2009-10-08 04:07:46 Re: Need help in spi_prepare errors