gpt4 book ai didi

sql - Redshift表列名自动转小写问题

转载 作者:行者123 更新时间:2023-12-05 05:16:38 28 4
gpt4 key购买 nike

我在通过查询从 redshift 表中获取数据时遇到问题。例如:

table name:   test_users
column names: user_id, userName, userLastName

现在正在创建 test_users table 它转换 userName 的大写字母列到 usernameuserLastName 类似将转换为 userlastname .

我找到了将所有列转换为大写或小写的方法,但无法按原样获取。

最佳答案

遗憾的是,AWS Redshift 在撰写本文时(2020 年 2 月)不支持区分大小写的标识符。而且,虽然 Redshift 基于 PostgreSQL,但 AWS 对其进行了大量修改,以至于许多对 PostgreSQL 8 正确的假设对 Redshift 不正确。

文档位于 https://docs.aws.amazon.com/redshift/latest/dg/r_names.html明确声明它将标识符小写。相关段落如下,关键句子加粗:

Names identify database objects, including tables and columns, as well as users and passwords. The terms name and identifier can be used interchangeably. There are two types of identifiers, standard identifiers and quoted or delimited identifiers. Identifiers must consist of only UTF-8 printable characters. ASCII letters in standard and delimited identifiers are case-insensitive and are folded to lowercase in the database. In query results, column names are returned as lowercase by default. To return column names in uppercase, set the describe_field_name_in_uppercase configuration parameter to true.

关于sql - Redshift表列名自动转小写问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50209379/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com