Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
A warning about a new behavior introduced in SR4. Using the RENAME statement to rename a field to an existing name was never allowed, but it used to fail silently. It will now generate a script error with the message:
Error: New field name already exists!
I think this is a good thing. But heads up that some scripts that ran without error may throw an error on SR4.
-Rob
Hi Rob,
can you post an example of script that generate this error?
Happy new year.
Thanks
Luca Jonathan Panetta
Dear Rob,
Yes, in other versions it just skips it silently.
and in SR 4 also Renaming to same field name does not throw error when using map table to rename but throws error when rename a single field to any existing field name.
but I feel that rename should be allowed if the tables of those fields are different, so explicit links based on the rename can be created,
what if there is a case when I have 3 fields A, B and C and later I want to rename B also to C then it is not allowing .
Just my 2 cents.
What is your take on this?
Regards,
Ashutosh
Message was edited because of some findings: Ashutosh Paliwal
Luca,
Here's an example:
Tab1:
LOAD 1 as X AUTOGENERATE 1;
Tab2:
LOAD 1 as Y AUTOGENERATE 1;
RENAME FIELD X to Y;
-Rob
Ashutosh,
I also would like to be able to rename a field to an existing name. Bug 35832 "Rename field doesn't work when field name already exists" seemed to be resolved by generating an error message. So I assume this is now an Idea and not a support issue. I'll open an idea and those of us who want it can vote it up.
-Rob
Yes Rob, It will be nice to have this.
But, I don't understand why they implemented it in 10 SR 4 only and not in 11 IR (May be they are planning in future releases).
Also, It does not throw error when renamed through a table.
Still, Please make it as as idea, so we can vote it up and lets see if we get this implemented.
....
Ashutosh
Thanks for the post, I just ran into this also. Script was working fine in v11 IR and then started failing after upgrade to 11 SR1.
Hi Rob,
Thanks a lot, for sharing this information.
I understand "RENAME FIELD X to Y;" doesn't work anymore.
Can you please provide a workaround to this error?
PS: We just migrated from QV10 SR3 to QV11 SR1 and are facing the same issue.
Thanks,
Nishit Shah.
The response ois to remove the statement. Prior to SR4, the statement did not throw an error, but it did not perform the rename either. So removing the statement will resolve the error and give the same results as SR3.
-Rob
Hi Nishit,
a workaround can be to create a table with qualified fied or with other fild name eg. X_tmp and to make a new LOAD to rename the field and make a relation between the two tables.
I use the Rob's example
To make: RENAME FIELD X to Y;
Tab1_tmp:
LOAD
0 as F1_tmp,
1 as X_tmp
AUTOGENERATE 1;
Tab2:
LOAD 1 as Y AUTOGENERATE 1;
Tab1:
LOAD
F1_tmp as F1
X_tmp as Y
Resident Tab1_tmp;
I don't like so much this solution but somethime is the only.
PS: Rob, I have voted your IDEA.
Regards
Luca Jonathan Panetta