Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpDU0-0003HZ-8F for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 15:10:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpDTy-0001dI-ST for pgsql-admin@arkaria.postgresql.org; Sun, 21 Jul 2019 15:10:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpDTy-0001ZR-Gv for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 15:10:38 +0000 Received: from sonic304-9.consmr.mail.bf2.yahoo.com ([74.6.128.32]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpDTw-0004MH-AX for pgsql-admin@lists.postgresql.org; Sun, 21 Jul 2019 15:10:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1563721833; bh=GxRyMsnUQhFNIkr49hESbMS/dISIwcUCWTrsHHZKA7Q=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=q7qNx3rgqdIC1aXBXyRm1HRcLwwuxapGlibT+avWbH26LixERXUAkmbxYDpn/ysq4gGoZwTfCi3e1Tad3/CPxMHpmnh62c+VZ0luwyQ0oJW3V5Kkd2HVJP9mF097Qkk5YaYOKySer+rF7jmKIeC9iJ3lkVaFEK2uDDZEdyMYVPfqbhYF2gUAk6hiZrWD+9my8sKanHcLKs/hJN9NSnPtVShf0xPR5kTFYH4YsyMOWVdkSPQoQXyK2ZcAmUuxSdJ22eUj1nYGGb1MgW/aIcc1vSpPI/Porklg/rA02omNua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uCUTnjHtEViEyoXUSh6CoMSDzW2.gcz6rt5v7Wn4 OgDmP2e5LLVxkd_jFeVQC6Q.tr_ueQ02bps47pUYbUqPU9qFLnNSvVZKhjxnS508uBOBVw2PmnU3 ehLt8b4swj72Izn6z9sNpo7mqQneTjqSXTw3nRplCFj1yUCw2ry_9zFUQEEJCmmB4SE7bBBCk0Pb wDFcNRq4W9PhtUa.ogRc57CIYYHuvVyumqreG4lPlb14ZvQoyHZX3oBThB2RKLePKRPdUtdlYFpQ 1inKWVdjTvsaeJtVUIkpy5bt5cjEqMLFTib71ifT_OA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Sun, 21 Jul 2019 15:10:33 +0000 Date: Sun, 21 Jul 2019 15:10:31 +0000 (UTC) From: Karen Goh To: "David G. Johnston" Cc: pgsql-admin@lists.postgresql.org, Ron Message-ID: <2030754658.2646264.1563721831668@mail.yahoo.com> In-Reply-To: References: <820008379.2579287.1563670685484@mail.yahoo.com> <5CE41E80-274A-44DA-9553-E2DCA260F751@jakobs.com> <385857992.2643116.1563717238725@mail.yahoo.com> <923fb3b1-90e9-e0b5-bc5b-d896128c3f28@gmail.com> <1745586001.2633224.1563719075867@mail.yahoo.com> <905425626.2686338.1563721213121@mail.yahoo.com> Subject: Re: How do I alter an existing column and add a foreign key which is a Primary key to a table? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2646263_1976778049.1563721831667" Content-Length: 2167 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_2646263_1976778049.1563721831667 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 On Sunday, July 21, 2019, 11:06:16 PM GMT+8, David G. Johnston wrote: On Sunday, July 21, 2019, Karen Goh wrote: Is there a way for me to generate an entity table diagram vis pgAdmin4 or = PSQL ? Just write the 5 or so tables out in a somewhat compressed format. Psql doe= sn=E2=80=99t and I don=E2=80=99t know about pgadmin Here is a compressed format : s_tutor -------- zipcode(text) tutor_id (I just checked this is becomes a 'serial id ?' based on the gener= ated sql ALTER TABLE public.s_tutor ALTER COLUMN tutor_id ADD GENERATED BY DEFAULT A= S IDENTITY ( SEQUENCE NAME public.tutor_strtutorid_seq START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1 ); tutor_subject ---------------- tutor_id subject_Names David J. =20 ------=_Part_2646263_1976778049.1563721831667 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable





On Sunday, July 21, 2019, 11:06:16= PM GMT+8, David G. Johnston <david.g.johnston@gmail.com> wrote:
<= br>
On Sunday, July 21, 2019, Karen Goh <karenworld@yahoo.com> wro= te:


Is there a way for me to generate an entity table diagra= m vis pgAdmin4 or PSQL ?


Just write the 5 or so tables out in a = somewhat compressed format. Psql doesn=E2=80=99t and I don=E2=80=99t know = about pgadmin

Here is a compressed format :

s_tutor
------= --
zipcode(text)
tutor_id (I just checked this is becomes a 'seri= al id ?' based on the generated sql

ALTER TABLE public.s_tutor A= LTER COLUMN tutor_id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE= NAME public.tutor_strtutorid_seq
START WITH 1
INCREMENT BY 1=
NO MINVALUE
NO MAXVALUE
CACHE 1
);

tutor_su= bject
----------------
tutor_id
subject_Names



David= J.
=20 ------=_Part_2646263_1976778049.1563721831667--