From marcio@zyontecnologia.com.br Wed Sep 12 02:11:57 2018 Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzudh-0007Ca-Pd for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 02:12: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 1fzudd-00075I-6k for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 02:12:17 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzudc-00075A-Tj for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 02:12:16 +0000 Received: from chocolate.concordia.psi.br ([189.91.194.3]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzudS-0003o5-Lp for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 02:12:13 +0000 Received: from Marcio (unknown [186.226.37.77]) (Authenticated sender: marcio@zyontecnologia.com.br) by chocolate.concordia.psi.br (Postfix) with ESMTPA id 5276C1000C2B for ; Tue, 11 Sep 2018 23:11:58 -0300 (BRT) From: =?iso-8859-1?Q?M=E1rcio_Ant=F4nio_Sepp?= To: Subject: Table cannot be partiotioned using domain in argument Date: Tue, 11 Sep 2018 23:11:57 -0300 Message-ID: <012d01d44a3d$fb7c6100$f2752300$@com.br> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_012E_01D44A24.D62F2900" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdRKPftc/sZisp+YQa6YRR3hQwmv9A== Content-Language: pt-br List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_012E_01D44A24.D62F2900 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 Hi, =20 =20 This query works fine: =20 create table t1 (d date) PARTITION BY RANGE (d); CREATE TABLE t1_p1 PARTITION OF t1 FOR VALUES FROM ('2000-01-01') TO ('2019-01-01'); =20 =20 =20 Same query, but now (using domain): =20 CREATE DOMAIN ddate AS date; =20 create table t1 (d ddate) PARTITION BY RANGE (d); CREATE TABLE t1_p1 PARTITION OF t1 FOR VALUES FROM ('2000-01-01') TO ('2019-01-01'); =20 The follow error occur: =20 SQL Error [42804]: ERROR: specified value cannot be cast to type ddate = for column "d" Detalhe: The cast requires a non-immutable conversion. Dica: Try putting the literal value in single quotes. Posi=E7=E3o: 55 =20 I cannot use domain in this case? =20 =20 Thanks in advance! =20 -- Att M=E1rcio=20 =20 ------=_NextPart_000_012E_01D44A24.D62F2900 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

 

Hi,

 

 

This query = works fine:

 <= /o:p>

create = table= = t1

(d = date)

PARTITION = BY = RANGE= = (d);

CREATE = TABLE= = t1_p1 PARTITION = OF t1 = FOR = VALUES = FROM<= /b> = ('2000-01-01'<= /span>) = TO = ('2019-01-01'<= /span>);

 

 

 

Same query, = but now (using domain):

 <= /o:p>

CREATE = DOMAIN = ddate

=A0=A0=A0 = AS = date;

 <= /p>

create = table= = t1

(d = ddate)

PARTITION = BY = RANGE= = (d);

CREATE = TABLE= = t1_p1 PARTITION = OF t1 = FOR = VALUES = FROM<= /b> = ('2000-01-01'<= /span>) = TO = ('2019-01-01'<= /span>);

 

The follow = error occur:

 

SQL Error [42804]: ERROR: specified value cannot be = cast to type ddate for column "d"

=A0 Detalhe: The cast requires a non-immutable = conversion.

=A0 Dica: Try putting the = literal value in single quotes.

=A0 = Posi=E7=E3o: 55

 

I cannot use = domain in this case?

 

 

Thanks in = advance!

 

--

Att

M=E1rcio =

 

------=_NextPart_000_012E_01D44A24.D62F2900-- From tgl@sss.pgh.pa.us Wed Sep 12 03:20:49 2018 Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzviA-0001lH-C3 for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 03:21:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzvi5-00014s-My for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 03:20:57 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzvi5-00014l-EZ for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 03:20:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzvi1-0005fI-Ei for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 03:20:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w8C3Knq8001189; Tue, 11 Sep 2018 23:20:49 -0400 From: Tom Lane To: =?iso-8859-1?Q?M=E1rcio_Ant=F4nio_Sepp?= cc: pgsql-general@lists.postgresql.org Subject: Re: Table cannot be partiotioned using domain in argument In-reply-to: <012d01d44a3d$fb7c6100$f2752300$@com.br> References: <012d01d44a3d$fb7c6100$f2752300$@com.br> Comments: In-reply-to =?iso-8859-1?Q?M=E1rcio_Ant=F4nio_Sepp?= message dated "Tue, 11 Sep 2018 23:11:57 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1187.1536722449.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 11 Sep 2018 23:20:49 -0400 Message-ID: <1188.1536722449@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?iso-8859-1?Q?M=3DE1rcio_Ant=3DF4nio_Sepp?=3D writes: > The follow error occur: > SQL Error [42804]: ERROR: specified value cannot be cast to type ddate f= or > column "d" > Detalhe: The cast requires a non-immutable conversion. > I cannot use domain in this case? Nope. The problem is suggested, if not exactly clearly explained, by the error message: casting a literal to ddate isn't a guaranteed fixed process. For example, suppose you created this table and then did alter domain ddate add check (value > '2020-01-01'); thereby rendering the partition bound values illegal for the domain. What would you expect to happen then? We might at some point work out plausible semantics for this situation, but it hasn't been done yet. regards, tom lane From marcio@zyontecnologia.com.br Wed Sep 12 03:46:19 2018 Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzw6x-0002md-3Y for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 03:46:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzw6u-0007Xf-RL for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 03:46:36 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzw6u-0007XV-Iq for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 03:46:36 +0000 Received: from chocolate.concordia.psi.br ([189.91.194.3]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzw6m-0006Fx-Bo for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 03:46:35 +0000 Received: from [192.168.0.103] (unknown [189.91.201.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: marcio@zyontecnologia.com.br) by chocolate.concordia.psi.br (Postfix) with ESMTPSA id 0CA9E101E530; Wed, 12 Sep 2018 00:46:22 -0300 (BRT) Date: Wed, 12 Sep 2018 00:46:19 -0300 Subject: Re: Table cannot be partiotioned using domain in argument Message-ID: X-Android-Message-ID: In-Reply-To: <1188.1536722449@sss.pgh.pa.us> From: =?ISO-8859-1?Q?M=E1rcio_A=2E_Sepp?= To: Tom Lane Cc: pgsql-general@lists.postgresql.org Importance: Normal X-Priority: 3 X-MSMail-Priority: Normal MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PGRpdiBkaXI9J2F1dG8nPjxkaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9 ImdtYWlsX3F1b3RlIj5IaSBhbmQgdGhhbmtzIGZvciBhbnN3ZXIsPGJyPjxibG9ja3F1b3RlIGNs YXNzPSJxdW90ZSIgc3R5bGU9Im1hcmdpbjowIDAgMCAuOGV4O2JvcmRlci1sZWZ0OjFweCAjY2Nj IHNvbGlkO3BhZGRpbmctbGVmdDoxZXgiPjxwIGRpcj0ibHRyIj4KTm9wZS4mbmJzcDsgVGhlIHBy b2JsZW0gaXMgc3VnZ2VzdGVkLCBpZiBub3QgZXhhY3RseSBjbGVhcmx5IGV4cGxhaW5lZCwKPGJy PgpieSB0aGUgZXJyb3IgbWVzc2FnZTogY2FzdGluZyBhIGxpdGVyYWwgdG8gZGRhdGUgaXNuJ3Qg YSBndWFyYW50ZWVkCjxicj4KZml4ZWQgcHJvY2Vzcy4mbmJzcDs8L3A+PC9ibG9ja3F1b3RlPjwv ZGl2PjwvZGl2PjwvZGl2PjxkaXYgZGlyPSJhdXRvIj5X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