From: | Dimitri Fontaine <dfontaine(at)hi-media(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLE ... ALTER COLUMN ... SET DISTINCT |
Date: | 2009-07-17 15:10:50 |
Message-ID: | 3D8B55AC-05E1-4B22-8B80-ED92EC60C37D@hi-media.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Le 3 mai 09 à 22:13, Robert Haas a écrit :
> OK, new version of patch, this time with the weird scaling removed and
> the datatype changed to float4.
You've been assigning me this patch review, so here it goes :)
> I have not changed the minimum value for remoteVersion in pg_dump.c,
> as that would make the patch not able to be tested now. So that line
> and the comment two lines following will need to be updated prior to
> application. Also requires catversion bump.
I guess now would be a good time to fix this part of the patch?
I couldn't apply it to current head because of bitrot. It applies fine
to git commit bcaef8b5a0e2d5c143dabd8516090a09e39b27b8 [1] but from
there the automatic forward merge of git isn't able to merge
pg_attribute.h. As I don't have as much time to give to the review as
I'd like, I'd very much welcome if you could fix this part of your
patch and I'll resume my work thereafter.
I'll change the patch status to "Waiting on Author" as soon as I'll
have this mail id.
Now I've had time to read the code, here are my raw notes:
pg_dump.c:
tbinfo->attstattarget[j] = atoi(PQgetvalue(res, j,
i_attstattarget));
+ tbinfo->attdistinct[j] = strdup(PQgetvalue(res, j,
i_attdistinct));
...
+ if (atof(tbinfo->attdistinct[j]) != 0 &&
+ !tbinfo->attisdropped[j])
- style issue, convert at PQgetvalue() time
- prefer strtod() over atof? Here's what my local man page has to
say about the case:
The atof() function has been deprecated by strtod() and should
not be used in
new code.
tablecmds.c:
+ switch (nodeTag(newValue))
+ {
+ case T_Integer:
...
+ case T_Float:
...
+ default:
+ elog(ERROR, "unrecognized node type: %d",
+ (int) nodeTag(newValue));
What about adding the following before the switch, to do like
surrounding code?
Assert(IsA(newValue, Integer) || IsA(newValue, Float));
Given your revised version I'll try to play around with ndistinct
behavior and exercise dump and restore, etc, but for now I'll pause my
work.
I guess I'll have a second look at the code to check that it's all in
the spirit of surrounding code, which I didn't complete yet (wanted to
exercise my abilities to apply the patch from a past commit and
forward-merge from there).
Regards,
--
dim
From | Date | Subject | |
---|---|---|---|
Next Message | Fernando Ike | 2009-07-17 15:26:31 | Re: [PATCH] Psql List Languages |
Previous Message | Richard Huxton | 2009-07-17 15:01:42 | OT: Testing - please ignore |