From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: cast result of copyObject() |
Date: | 2017-03-01 03:21:18 |
Message-ID: | c2e5f74f-5602-926a-6999-78857ffd8a03@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> The problem this patch would address is that currently you can write
>
> SomeNode *x = ...;
>
> ...
>
>
> OtherNode *y = copyObject(x);
>
> and there is no notice about that potential mistake.
>
> This patch makes that an error.
>
> If you are sure about what you are doing, you can add a cast. But
> casting the result of copyObject() should be limited to a few specific
> cases where the result is assigned to a generic Node * or something like
> that.
Updated patch, which I will register in the commit fest for some wider
portability testing (Windows!).
(changed subject copyNode -> copyObject (was excited about castNode at
the time))
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Cast-result-of-copyObject-to-correct-type.patch | text/x-patch | 39.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-03-01 03:22:28 | Re: PATCH: Make pg_stop_backup() archive wait optional |
Previous Message | Andres Freund | 2017-03-01 03:18:05 | Re: Performance degradation in TPC-H Q18 |