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 1isrLq-0006wU-0L for pgsql-general@arkaria.postgresql.org; Sat, 18 Jan 2020 16:53:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1isrLo-00024Q-Es for pgsql-general@arkaria.postgresql.org; Sat, 18 Jan 2020 16:53:32 +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 1isrLo-000218-4X for pgsql-general@lists.postgresql.org; Sat, 18 Jan 2020 16:53:32 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1isrLl-00034K-2M for pgsql-general@lists.postgresql.org; Sat, 18 Jan 2020 16:53:31 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 480PBt25gmz1V5Q for ; Sat, 18 Jan 2020 11:53:26 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 480PBt0tLtzfYh; Sat, 18 Jan 2020 11:53:26 -0500 (EST) Date: Sat, 18 Jan 2020 11:53:25 -0500 From: stan To: pgsql-general@lists.postgresql.org Subject: A question about rules Message-ID: <20200118165325.GB21472@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk So, I just discovered the rules system. As I understand it, it can be used to rewrite queries before they are passed to the query processor. I was wondering if I could use this to resolve a long standing frustration of mine. I often need to declare a column as NON NULL, and create a trigger/function to auto populate it with something more complex than a simple sequence. This need arises fairly often for me, and I would like to come up with a good way to implement this. Sorry for such a newbie question. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin