Обсуждение: foreing key .. reference..

Поиск
Список
Период
Сортировка

foreing key .. reference..

От
Andres Ledesma
Дата:
Hi evbody...

Could anybody give me an example of foreing key ..references example ?

Thx ind advance !

Andrew

Re: foreing key .. reference..

От
Andrew McMillan
Дата:
On Sat, 2003-02-22 at 12:13, Andres Ledesma wrote:
> Hi evbody...
>
> Could anybody give me an example of foreing key ..references example ?


Here is an example from one of our applications.

Regards,
                    Andrew.

---------------------------
-- Contact Details
---------------------------
CREATE TABLE contact (
  contact_id INT4,
  name TEXT,
  address1 TEXT,
  address2 TEXT,
  city TEXT,
  state TEXT,
  country TEXT,
  postcode TEXT,
  phone TEXT,                    -- format is "+<contrycode>
(<areacode>) <localnumber>"
  fax TEXT,                      -- format is "+<contrycode>
(<areacode>) <localnumber>"
  email TEXT,
  PRIMARY KEY ( contact_id )
);


---------------------------
-- Registrar Details
---------------------------
CREATE TABLE registrar (
  registrar_id INT4,
  p_contactid INT4,
  d_contactid INT4,
  s_contactid INT4,
  registrar_name TEXT,
  commenced TIMESTAMP,
  PRIMARY KEY ( registrar_id ),
  CONSTRAINT p_contact_of_contact FOREIGN KEY ( p_contactid ) REFERENCES
contact,
  CONSTRAINT d_contact_of_contact FOREIGN KEY ( d_contactid ) REFERENCES
contact,
  CONSTRAINT s_contact_of_contact FOREIGN KEY ( s_contactid ) REFERENCES
contact
);


--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with http://survey.net.nz/
---------------------------------------------------------------------


Re: foreing key .. reference..thanks a lot ...

От
Andres Ledesma
Дата:
thanks a lot

best regards,

Andrew

postmaster does not shut down

От
Jeff Deroshia
Дата:
I'm running PostgreSQL 7.4 on Mac OS X server 10.3.3.  When I try
pg_ctl stop as the postgres user, it times out waiting for postmaster
to shut down, gives a failed error, then: pg_ctl: postmaster does not
shut down

The only thing I'm able to do is kill -9 <pid> then rm the pid file.
This is not very good.  Anyone know what would keep postmaster from
shutting down?

Thanks,
Jeff Deroshia


------------------------------------
Jeff Deroshia
Network Services Specialist
Department of Physics and Astronomy
The University of Georgia
706-542-3622
------------------------------------


Re: postmaster does not shut down

От
Tom Lane
Дата:
Jeff Deroshia <jeff@hal.physast.uga.edu> writes:
> I'm running PostgreSQL 7.4 on Mac OS X server 10.3.3.  When I try
> pg_ctl stop as the postgres user, it times out waiting for postmaster
> to shut down, gives a failed error, then: pg_ctl: postmaster does not
> shut down

> The only thing I'm able to do is kill -9 <pid> then rm the pid file.
> This is not very good.  Anyone know what would keep postmaster from
> shutting down?

A persistent client connection.  If you want to kick out active clients,
you need (IIRC) "-m fast" option to pg_ctl stop.

In any case, "kill -9" on the postmaster is a particularly horrid idea
on OSX, because there's no way to clean up the leftover shared memory
segment (since Apple doesn't provide ipcrm).  My experience is that you
have to reboot to get rid of the old shmem seg if you do this.  Pretend
you never learned that command, and find an alternative.

            regards, tom lane