Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UR0AN-000417-6K for pgsql-docs@arkaria.postgresql.org; Sat, 13 Apr 2013 13:06:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UR0AM-0007su-KK for pgsql-docs@arkaria.postgresql.org; Sat, 13 Apr 2013 13:06:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UR0AM-0007sp-5f for pgsql-docs@postgresql.org; Sat, 13 Apr 2013 13:06:50 +0000 Received: from mout.gmx.net ([212.227.15.19]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UR0AJ-0008LQ-5z for pgsql-docs@postgresql.org; Sat, 13 Apr 2013 13:06:49 +0000 Received: from mailout-de.gmx.net ([10.1.76.34]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0LtC3J-1UXyST3KiB-012r83 for ; Sat, 13 Apr 2013 15:06:46 +0200 Received: (qmail invoked by alias); 13 Apr 2013 13:06:46 -0000 Received: from pool-108-52-108-60.phlapa.fios.verizon.net (EHLO [192.168.1.7]) [108.52.108.60] by mail.gmx.net (mp034) with SMTP; 13 Apr 2013 15:06:46 +0200 X-Authenticated: #495269 X-Provags-ID: V01U2FsdGVkX184Kd96/Y84vYXA/X5uHMrmub4QwQwiDbr/QlKb7Z npr3lylqt5OO5N Message-ID: <1365858403.20086.7.camel@vanquo.pezone.net> Subject: Re: User defined type without single quotes From: Peter Eisentraut To: Rodrigo Barboza Cc: pgsql-docs@postgresql.org Date: Sat, 13 Apr 2013 09:06:43 -0400 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4-3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org On Thu, 2013-04-04 at 19:50 -0300, Rodrigo Barboza wrote: > -- my_uint32 is my new type > CREATE TABLE test (a my_uin32); > > If I try to run this insert, postgres complain about the type: > INSERT INTO teste (a) VALUES (10); > > But this one works: > NSERT INTO teste (a) VALUES ('10'::my_uint); > > Is there a way to avoid the single quotes? > A constant like 10 is initially assigned one of the integer types (the exact rules are in the documentation). In order to be able to store that into a column of a custom type, you need to define a cast between the integer type and your type with at least assignment context. -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs