Re: [HACKERS] DOMAINs and CASTs

2012-04-24 Thread Robert Haas
On Tue, Apr 24, 2012 at 3:00 AM, Jaime Casanova wrote: > are we going to put this warning in this release? Done. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to

Re: [HACKERS] DOMAINs and CASTs

2012-04-24 Thread Jaime Casanova
On Tue, Nov 29, 2011 at 10:12 PM, Robert Haas wrote: > On Tue, Nov 29, 2011 at 11:11 AM, Jaime Casanova > wrote: >> On Tue, Nov 29, 2011 at 10:42 AM, Tom Lane wrote: >>> Bruce Momjian writes: Tom Lane wrote: > Robert Haas writes: >> Well, if we apply this, it has the possibility

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Robert Haas
On Tue, Nov 29, 2011 at 11:11 AM, Jaime Casanova wrote: > On Tue, Nov 29, 2011 at 10:42 AM, Tom Lane wrote: >> Bruce Momjian writes: >>> Tom Lane wrote: Robert Haas writes: > Well, if we apply this, it has the possibility to break existing > dumps. >> >> BTW, it occurs to me that w

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Jaime Casanova
On Tue, Nov 29, 2011 at 10:42 AM, Tom Lane wrote: > Bruce Momjian writes: >> Tom Lane wrote: >>> Robert Haas writes: Well, if we apply this, it has the possibility to break existing dumps. > > BTW, it occurs to me that we could dodge that objection, with much less > work than Robert su

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Tom Lane
Bruce Momjian writes: > Tom Lane wrote: >> Robert Haas writes: >>> Well, if we apply this, it has the possibility to break existing >>> dumps. BTW, it occurs to me that we could dodge that objection, with much less work than Robert suggests, if we just made the message be a WARNING not an ERROR.

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Bruce Momjian
Tom Lane wrote: > Robert Haas writes: > > On Mon, Nov 28, 2011 at 9:46 PM, Bruce Momjian wrote: > >> What happened to this patch for casts on domains from June? > > > Well, if we apply this, it has the possibility to break existing > > dumps. > > There's also the question of whether there's rea

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Tom Lane
Robert Haas writes: > On Mon, Nov 28, 2011 at 9:46 PM, Bruce Momjian wrote: >> What happened to this patch for casts on domains from June? > Well, if we apply this, it has the possibility to break existing > dumps. There's also the question of whether there's really much point. The whole questi

Re: [HACKERS] DOMAINs and CASTs

2011-11-29 Thread Robert Haas
On Mon, Nov 28, 2011 at 9:46 PM, Bruce Momjian wrote: > David Fetter wrote: >> On Mon, Jun 13, 2011 at 03:39:39AM -0500, Jaime Casanova wrote: >> > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: >> > > On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: >> > >> On Tue, May 17, 2011

Re: [HACKERS] DOMAINs and CASTs

2011-11-28 Thread Bruce Momjian
David Fetter wrote: > On Mon, Jun 13, 2011 at 03:39:39AM -0500, Jaime Casanova wrote: > > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: > > > On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: > > >> On Tue, May 17, 2011 at 12:19 PM, Robert Haas > > >> wrote: > > >> > > > >> > Th

Re: [HACKERS] DOMAINs and CASTs

2011-10-14 Thread Robert Haas
On Fri, Oct 14, 2011 at 3:19 PM, Bruce Momjian wrote: > Where are we on this? Well, I don't know. We had a couple of different ideas on what to do about it, and I'm not sure anyone was completely in love with any of the available options. -- Robert Haas EnterpriseDB: http://www.enterprisedb.co

Re: [HACKERS] DOMAINs and CASTs

2011-10-14 Thread Bruce Momjian
Where are we on this? --- David Fetter wrote: > On Mon, Jun 13, 2011 at 03:39:39AM -0500, Jaime Casanova wrote: > > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: > > > On tis, 2011-05-17 at 14:11 -0500, Jaime Casa

Re: [HACKERS] DOMAINs and CASTs

2011-06-13 Thread David Fetter
On Mon, Jun 13, 2011 at 03:39:39AM -0500, Jaime Casanova wrote: > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: > > On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: > >> On Tue, May 17, 2011 at 12:19 PM, Robert Haas > >> wrote: > >> > > >> > The more controversial question is w

Re: [HACKERS] DOMAINs and CASTs

2011-06-13 Thread Robert Haas
On Mon, Jun 13, 2011 at 4:39 AM, Jaime Casanova wrote: > On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: >> On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: >>> On Tue, May 17, 2011 at 12:19 PM, Robert Haas wrote: >>> > >>> > The more controversial question is what to do if someo

Re: [HACKERS] DOMAINs and CASTs

2011-06-13 Thread Jaime Casanova
On Mon, Jun 6, 2011 at 6:36 AM, Peter Eisentraut wrote: > On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: >> On Tue, May 17, 2011 at 12:19 PM, Robert Haas wrote: >> > >> > The more controversial question is what to do if someone tries to >> > create such a cast anyway.  We could just ign

Re: [HACKERS] DOMAINs and CASTs

2011-06-06 Thread Peter Eisentraut
On tis, 2011-05-17 at 14:11 -0500, Jaime Casanova wrote: > On Tue, May 17, 2011 at 12:19 PM, Robert Haas wrote: > > > > The more controversial question is what to do if someone tries to > > create such a cast anyway. We could just ignore that as we do now, or > > we could throw a NOTICE, WARNING,

Re: [HACKERS] DOMAINs and CASTs

2011-05-19 Thread Robert Haas
On Tue, May 17, 2011 at 3:11 PM, Jaime Casanova wrote: > On Tue, May 17, 2011 at 12:19 PM, Robert Haas wrote: >> >> The more controversial question is what to do if someone tries to >> create such a cast anyway.  We could just ignore that as we do now, or >> we could throw a NOTICE, WARNING, or E

Re: [HACKERS] DOMAINs and CASTs

2011-05-17 Thread Robert Haas
On Tue, May 17, 2011 at 12:29 AM, Jaime Casanova wrote: > On Sun, May 15, 2011 at 9:14 PM, Robert Haas wrote: >> >> we should probably try to agree on which >> of the various options you mention makes most sense. > > well... my original patch only handle the simplest case, namely, try > to make t

Re: [HACKERS] DOMAINs and CASTs

2011-05-17 Thread Jaime Casanova
On Tue, May 17, 2011 at 12:19 PM, Robert Haas wrote: > > The more controversial question is what to do if someone tries to > create such a cast anyway.  We could just ignore that as we do now, or > we could throw a NOTICE, WARNING, or ERROR. IMHO, not being an error per se but an implementation l

Re: [HACKERS] DOMAINs and CASTs

2011-05-16 Thread Darren Duncan
Jaime Casanova wrote: On Sun, May 15, 2011 at 9:14 PM, Robert Haas wrote: we should probably try to agree on which of the various options you mention makes most sense. well... my original patch only handle the simplest case, namely, try to make the cast that the user wants and if none is defi

Re: [HACKERS] DOMAINs and CASTs

2011-05-16 Thread Jaime Casanova
On Sun, May 15, 2011 at 9:14 PM, Robert Haas wrote: > > we should probably try to agree on which > of the various options you mention makes most sense. > well... my original patch only handle the simplest case, namely, try to make the cast that the user wants and if none is defined fall to the ba

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Robert Haas
On Sun, May 15, 2011 at 10:13 PM, Jaime Casanova wrote: > On Sun, May 15, 2011 at 9:01 PM, Robert Haas wrote: >> On Sun, May 15, 2011 at 7:43 PM, Jaime Casanova >> wrote: >>> still, we have a problem... because we are happily ignoring correctely >>> created casts... >>> at least, we should docu

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Jaime Casanova
On Sun, May 15, 2011 at 9:01 PM, Robert Haas wrote: > On Sun, May 15, 2011 at 7:43 PM, Jaime Casanova wrote: >> still, we have a problem... because we are happily ignoring correctely >> created casts... >> at least, we should document that casts on domains are ignored and >> that we should use th

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Robert Haas
On Sun, May 15, 2011 at 7:43 PM, Jaime Casanova wrote: > still, we have a problem... because we are happily ignoring correctely > created casts... > at least, we should document that casts on domains are ignored and > that we should use the base types instead, maybe even a warning or a > notice wh

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Jaime Casanova
On Sun, May 15, 2011 at 1:53 PM, Robert Haas wrote: > > So let's think about some harder scenarios. > > Given two types T1 and T2, and two domains D1 over T1 and D2 over T2, > and a cast from a value of type D1 to type D2, then: > ok. a few fair questions, thanks > (1) If there is an implicit ca

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Robert Haas
On Sun, May 15, 2011 at 3:26 AM, Jaime Casanova wrote: > Obviously it should run the cast from timestamp to int, why it will > run a cast from a domain? So let's think about some harder scenarios. Given two types T1 and T2, and two domains D1 over T1 and D2 over T2, and a cast from a value of ty

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Jaime Casanova
On Sun, May 15, 2011 at 2:13 AM, Darren Duncan wrote: > >  ('1800-01-01 00:00:00'::timestamp)::int > > Now, since all values of a DOMAIN are also values of the base type the > DOMAIN is defined as being a subset of, then the sub-expression within the > parenthesis denotes a value that is both a ti

Re: [HACKERS] DOMAINs and CASTs

2011-05-15 Thread Darren Duncan
Jaime Casanova wrote: On Sat, May 14, 2011 at 8:42 PM, Darren Duncan wrote: First of all, what if "cast(timestamp as int)" was already defined? Which cast then would you expect to be invoked here? '1800-01-01 00:00:00'::int i will expect an error in that case... what you're doing there is

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Jaime Casanova
On Sat, May 14, 2011 at 8:42 PM, Darren Duncan wrote: > > First of all, what if "cast(timestamp as int)" was already defined?  Which > cast then would you expect to be invoked here? > >  '1800-01-01 00:00:00'::int > i will expect an error in that case... what you're doing there is casting an "unk

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Gelman
- Original Message - From: "Darren Duncan" To: "Jaime Casanova" Cc: "PostgreSQL-development" Sent: Saturday, May 14, 2011 9:46 PM Subject: Re: [HACKERS] DOMAINs and CASTs Darren Duncan wrote: I think it would be best that the generic cast syntax only

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Darren Duncan
Darren Duncan wrote: I think it would be best that the generic cast syntax only be useable for casts defined on the base type, and if you want a domain-specific one you should use the function syntax such as your datetime2int(). That way it is easier for users to predict what behavior will occ

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Darren Duncan
Jaime Casanova wrote: If i create a DOMAIN an then want to create a CAST from that domain to another type it gives an error. Consider this example: """ create domain datetime as timestamp with time zone check (value between '1753-01-01 00:00:00' and '-12-31 23:59:59'); create function dat

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Jaime Casanova
On Sat, May 14, 2011 at 5:13 PM, Tom Lane wrote: > Jaime Casanova writes: >> If i create a DOMAIN an then want to create a CAST from that domain to >> another type it gives an error. > > It's *not* trivial to fix, at least not in a way that gives desirable > behavior for more than the simplest ca

Re: [HACKERS] DOMAINs and CASTs

2011-05-14 Thread Tom Lane
Jaime Casanova writes: > If i create a DOMAIN an then want to create a CAST from that domain to > another type it gives an error. Yes. See previous discussions about that, e.g. these threads: http://archives.postgresql.org/pgsql-hackers/2006-05/msg00072.php http://archives.postgresql.org/pgsql-