Uh oh!
There was an error while loading. Please reload this page.
PHOENIX-6519 Make SchemaTool work with lower case table and column names - #1275
Conversation
stoty
commented
Jul 26, 2021
💔 -1 overall
This message was automatically generated. |
stoty
left a comment
There was a problem hiding this comment.
In general, you may want to go over the code, and make variable names more consistent.
i.e. add Quoted to quoted names, etc.
| } | ||
| @Test | ||
| public void testCreateLocalIndexStatement() throws Exception { |
There was a problem hiding this comment.
It seems that you're also fixng some bugs WRT local indexes.
You should probablay note it at least in the commit message.
| private String generateTableDDLString(String columnInfoString, String propertiesString, | ||
| String pSchemaName, String pTableName) { | ||
| String pTableFullName = SchemaUtil.getPTableFullNameWithQuotes(pSchemaName, pTableName); | ||
| String pTableFullName = SchemaUtil.getFullTableNameWithQuotes(pSchemaName, pTableName); |
There was a problem hiding this comment.
You may want to go over the code, and change the quoted variable names according to some common template, to improbe readability.
| } | ||
| private static boolean quotesNeededForColumn(String name) { | ||
| if (!name.equals("_INDEX_ID") && "_".equals(String.valueOf(name.charAt(0)))) { |
There was a problem hiding this comment.
Why do we need the special case for tables beginning with underscore ?
Also getting the first character as string would can probably done in a less circumpect way.
There was a problem hiding this comment.
If we want to create a table named _FOO we need quotes around that. The same applies for column names.
The difference is that when we create an index, _INDEX_ID column is added automatically and we do not want to have quotes around that. (But it should be possible to create a table called "_INDEX_ID" even if it an abnormal name.)
There was a problem hiding this comment.
Thanks for the explanation.name.startsWith("_")
would be a far simpler check. (In the other methods as well.
There was a problem hiding this comment.
Sure, I'll upload a new change soon.
Change-Id: I643ed8c3db1ec7ebd0a68b13412a22ff7249f037
| } | ||
| public static String formatSchemaName(String name) { | ||
| if (quotesNeededForSchema(name)) { |
There was a problem hiding this comment.
Does the leading _ issue not apply here ?
There was a problem hiding this comment.
It does, in quotesNeededForSchema we check for some extra schema specific stuff but I call the quotesNeededForTable there.
richardantal
commented
Jul 29, 2021
Thank you @stoty for the reviews! |
stoty
commented
Jul 29, 2021
💔 -1 overall
This message was automatically generated. |
No description provided.