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 1hUEuX-0002QR-La for pgsql-general@arkaria.postgresql.org; Fri, 24 May 2019 18:27:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hUEuV-0000E4-A2 for pgsql-general@arkaria.postgresql.org; Fri, 24 May 2019 18:27:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUEuT-0000Dx-C3 for pgsql-general@lists.postgresql.org; Fri, 24 May 2019 18:27:19 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUEuP-0005qs-VS for pgsql-general@lists.postgresql.org; Fri, 24 May 2019 18:27:16 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 844245E0; Fri, 24 May 2019 14:27:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 24 May 2019 14:27:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=N tfLd4bNLVC5H6NipnBqi9DzO81ocjaQqtbBHA489Dw=; b=KAEv0VWzTbcRE3Jpe dAxKvkRAdRcDviEAwvv4nAwDgtef26UpZG8EW3anhCA372+mLeifJTmLN+83rpII H+iYIZEshtY+lacratnY9xw7SHiT52ZRwXLoWdr0i7hrSV+ADNDCSdpVcoeq6/wJ LuTpOMKyo9ppiiVyEMDUWwQlu//nBBuBfbRF9hD+8aknaPPMuiYqnoQO4dy0PcJp z+YQ8gv1hGMsVHEdnA8iOOm1RvDNJPznD4xZWNxdBplQxhYyWyLGe7LDHVkIpqIv 3J/7WdKDAfPFcrpKB75QlwVJXqRtIBfz1IMwadWHTC57AgtGQSlEjZxLPoxlLuGm d7AWw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=NtfLd4bNLVC5H6NipnBqi9DzO81ocjaQqtbBHA489 Dw=; b=0uiR0wEAkideXQvN7+z3omiYPqrMLJ6J/RJDyycQE7d2XFsfqzg5oirPF W+SFZKnOGVs8A3rAluR9V2NUnu8t5gDQyjtuJIWvLiJSuiqIcDK6mNBA7qTfMcQT XojmpzgMKbAbH/RljlQ3ZWl5Bsrx5RtLzy+4YOb4RlqoEPOUFK364KIW9p47fLvC wr3ckOs8dkMKJ1rUmTMYpEWv76Z0dy18SIu1STPG3AOEGr+bO4m0EXHcgH1gDipr F2RoNl220U38aGVGfauWG/sMp3zQkYEKPmNSN6A5igBSEm14b/9RzPVZIMfB0ZZ1 RrqQAyeiUCz73RTGBViubAP8bFtyA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrudduiedguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeehnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuffhomhgrihhnpehpkhifihhllhhishdrtghomhdpshhqihhttghhrdhorhhg necukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomh eprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghr ufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id EE8A638008A; Fri, 24 May 2019 14:27:09 -0400 (EDT) Subject: Re: Snippets? To: Ken Lacrosse , "'pgsql-general@lists.postgresql.org'" References: From: Adrian Klaver Message-ID: Date: Fri, 24 May 2019 11:27:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/24/19 11:15 AM, Ken Lacrosse wrote: > Is there any way in postgresql to have a "snippet" of SQL code which you > could apply to all tables.  Something you could add which would ensure > that every table always has a Created, Changed and Deleted column for > example.  Sort of like a C include I suppose.  Of course if I’m building > a DB schema by hand I could just copy and paste those columns but it > still seems a bit too, darn humans!, error prone. Not that I know of. Things I have done: 1) Template table that I includes those fields that I then add to. FYI the Sqitch schema management system allows you to do the above: https://sqitch.org/docs/manual/sqitch-add/#templates 2) A script that I run over table definition to add the fields. > > Ken LaCrosse > > Senior IT InfoSec and Infrastructure Monitoring Specialist > > I.T. | American Recovery Service & Skipbusters > > Phone: (800)398-6480 x3758 > > Email: KLacrosse@pkwillis.com > > www.pkwillis.com > > * Visibility is key. * > > Without visibility you can't see. > > What you can't see you can't measure. > > What you can't measure you can’t planfully change. > > What you can’t planfully change you can't manage. > > And if we can’t manage then why are we here? > > NOTICE: The information contained in this transmission, including > attachments, may contain confidential information that is privileged, > confidential and/or exempt from disclosure by applicable law. It is > intended only for the use of the person(s) or entity to which it is > addressed. If the reader of this transmission is not the intended > recipient, the reader is hereby notified that any review, use, > dissemination, distribution or duplication of this communication > (including any reliance thereon) is strictly prohibited. If you have > received this transmission in error, please contact the sender by reply > email, then delete and destroy the material in its entirety, whether in > electronic or hard copy format. WE SPECIFICALLY DISCLAIM RESPONSIBILITY > FOR ANY UNAUTHORIZED USE OF THIS COMMUNICATION OR ANY ATTACHMENTS TO IT. > Thank you. -- Adrian Klaver adrian.klaver@aklaver.com