(item)
| 71 | # We need to do some massaging of the names because postgres is case- |
| 72 | # insensitive and '"Foo"' is not the same table as 'Foo' (while 'foo' is) |
| 73 | def parse_identifier(item): |
| 74 | name = item.get_real_name() |
| 75 | schema_name = item.get_parent_name() |
| 76 | alias = item.get_alias() |
| 77 | if not name: |
| 78 | schema_name = None |
| 79 | name = item.get_name() |
| 80 | alias = alias or name |
| 81 | schema_quoted = schema_name and item.value[0] == '"' |
| 82 | if schema_name and not schema_quoted: |
| 83 | schema_name = schema_name.lower() |
| 84 | quote_count = item.value.count('"') |
| 85 | name_quoted = quote_count > 2 or (quote_count and not schema_quoted) |
| 86 | alias_quoted = alias and item.value[-1] == '"' |
| 87 | if alias_quoted or name_quoted and not alias and name.islower(): |
| 88 | alias = '"' + (alias or name) + '"' |
| 89 | if name and not name_quoted and not name.islower(): |
| 90 | if not alias: |
| 91 | alias = name |
| 92 | name = name.lower() |
| 93 | return schema_name, name, alias |
| 94 | |
| 95 | for item in token_stream: |
| 96 | if isinstance(item, IdentifierList): |
no outgoing calls
no test coverage detected