Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf9pU-0005HI-0l for pgsql-general@arkaria.postgresql.org; Tue, 17 Nov 2020 22:52:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kf9pS-0004Oe-6U for pgsql-general@arkaria.postgresql.org; Tue, 17 Nov 2020 22:52:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf9pR-0004Nq-Ui for pgsql-general@lists.postgresql.org; Tue, 17 Nov 2020 22:52:01 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf9pL-0002DE-Jp for pgsql-general@lists.postgresql.org; Tue, 17 Nov 2020 22:52:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 3046FB70; Tue, 17 Nov 2020 17:51:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 17 Nov 2020 17:51:54 -0500 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=fm1; bh=M JMhbitoc0d4jEzYZ+2HSGLOMb0JjvxQ+Sq/Zlv9IYg=; b=UUyHmtjeyaO8g1wtx YpKYl6xwjbVQN4C8W1Eet5poOe6Tq2hU2l2x1tKO1hayHnsHq266P89pPuXgSBDF BhSg3ejjFxn+hs5gJRxWIEgKRxr7Uj4DD+xUuqb09A6j3RnpU5rRADFdLIjg86Rj 3NePAHwhl60AUaQIbxAu683PFQ7SfGU4XwSzQ01q+osQZ5G/dhYp8Rdt/JWOLmVw aWb8CzXuOK59dQcjII+EAxXZwG1XY/caEylVLek6qGF96owY4veMaLxBly5RsJZ6 CnU2SSJGbs7GnGigc4FNeKVk76oKv85F8boCbDCokQjbcRvD129o63QyhwZJlOWI fPe3A== 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=fm1; bh=MJMhbitoc0d4jEzYZ+2HSGLOMb0JjvxQ+Sq/Zlv9I Yg=; b=N+ax+ogs8M1Kjhtskfyzb/qbuuBgohAdGe7wWuAHokkOi/deDgincs0VK YUvWaiWk3OT/B2S5iHDSyfzvkzkA1rTJYSwERODvD/1Vu7hjWMYjPPWovmMlX0W9 tesIXlbpI8ldRF+qSVhbjqnTPjaGcDpihJX6xcDC/knUMY54pa5blZJSdyAIq+du 4v+jIfEHlEbj7d6dR8fr/f1GCxO6Gq8DKYqSejcGDpDRRbaezTCDJ9iBzYfCo/U1 8CEHk9LUHzKZaGLPa6GJB25aWfg0aka3uYjxKx+B91zNt07qLjTNYE5lHhZAsGsf NdB3fxfVNqnHz6MXa8t0K78QGVyww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudefgedgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeetjedvteffjeeuvdelieeffeehuedthffgvdfhhffh kedvudevgedvjedufefgveenucfkphepjeehrddujedvrdduledrudefleenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-19-139.tukw.qwest.net [75.172.19.139]) by mail.messagingengine.com (Postfix) with ESMTPA id 65831328005A; Tue, 17 Nov 2020 17:51:52 -0500 (EST) Subject: Re: create type with %type or %rowtype To: Post Gresql , PostgreSQL General References: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se> From: Adrian Klaver Message-ID: <95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com> Date: Tue, 17 Nov 2020 14:51:51 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/17/20 2:12 PM, Post Gresql wrote: > Hello. > > It seems that I can not create a type with > > create type my_type as my_table%rowtype; To me that is redundant as a table has a composite type already. > > or > > create type my_type as my_table.my_column%type; In plpgsql %type is effectively a placeholder, not sure how well that would work in a created type. > > Correct? It seems to be a feature for plpgsql programing only, right? > > But wouldn't that be a good thing to be able to do? Or would it cause > too many problems? > > > Best regards > > > > -- Adrian Klaver adrian.klaver@aklaver.com