Re: Inherancing

From: "Daniel Schuchardt" <daniel_schuchardt(at)web(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Inherancing
Date: 2003-01-07 17:16:48
Message-ID: avf20d$m5v$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You have to insert in th centers-table. Because it is inherited from cities,
the record is automatically in cities. Search for SELECT * FROM ONLY in the
docs too.

> create table cities (id int, name varchar, primary key(id) );
> create table centers (state varchar(2)) inherits (cities);
>
> ant the tuple
> insert into cities values (1, 'Lajeado');

Lajeado isn't a center here. You should do :

insert into centers ....

You can do then SELECT * FROM cities -> you will get all cities. Or SELECT *
FROM centers -> you will get all centers. Or SELECT * FROM ONLY cities ->
you will get only cities who aren't centers.

Daniel.

"Nasair Junior da Silva" <njunior(at)univates(dot)br> schrieb im Newsbeitrag
news:20030107094225(dot)0345a050(dot)njunior(at)univates(dot)br(dot)(dot)(dot)
> Hi people,
> supposing i have the tables :
>
> create table cities (id int, name varchar, primary key(id) );
> create table centers (state varchar(2)) inherits (cities);
>
> ant the tuple
> insert into cities values (1, 'Lajeado');
>
> How i do if i want to make this city as a center ?
>
> Thanks,
>
> xx===============================xx
> || v Nasair Junior da Silva ||
> || /(_)\ Linux User: 246054 ||
> || ^ ^ njunior(at)univates(dot)br ||
> ||CPD - Desenvolvimento ||
> ||Univates - Centro Universitrio||
> xx===============================xx
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

  • Inherancing at 2003-01-07 11:42:25 from Nasair Junior da Silva

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-01-07 17:44:16 Re: [SQL] [PERFORM] 7.3.1 index use / performance
Previous Message Peter Galbavy 2003-01-07 16:45:31 Re: weighting (the results of) a query ?