pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Schuchardt <daniel_schuchardt@web.de>
To: pgsql-sql@postgresql.org
Subject: Re: Inherancing
Date: Tue, 7 Jan 2003 18:16:48 +0100
Message-ID: <avf20d$m5v$1@news.hub.org> (raw)
References: <20030107094225.0345a050.njunior@univates.br>

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@univates.br> schrieb im Newsbeitrag
news:20030107094225.0345a050.njunior@univates.br...
> 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@univates.br    ||
> ||CPD - Desenvolvimento          ||
> ||Univates - Centro Universitário||
> xx===============================xx
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org





view thread (5+ messages)

Message-ID: <avf20d$m5v$1@news.hub.org>
Permalink:  ../avf20d$m5v$1@news.hub.org/
Also on:    postgresql.org/message-id/avf20d$m5v$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: daniel_schuchardt@web.de
  Subject: Re: Inherancing
  In-Reply-To: <avf20d$m5v$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox