Datagrip代码错误突出显示行为不当,但仅限于1个DB

时间:2018-05-21 09:30:19

标签: amazon-redshift datagrip

我使用DataGrip处理包含大量数据库的Redshift集群,并且错误突出显示似乎有点奇怪。假设我在数据库<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"> <table id="tblRandomSummary" class="table table-hover table-striped table-bordered table-condensed responsive no-footer dtr-inline dataTable collapsed" role="grid" aria-describedby="tblRandomSummary_info" style="width: 1029px;"> <thead> <tr role="row"> <th class="sorting_asc" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 47px;" aria-label="Circuit: activate to sort column descending" aria-sort="ascending">Circuit</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 71px;" aria-label="WashType: activate to sort column ascending">WashType</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 115px;" aria-label="AverageDuration: activate to sort column ascending">AverageDuration</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 71px;" aria-label="FirstRinse: activate to sort column ascending">FirstRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 143px;" aria-label="CausticRecirculation: activate to sort column ascending">CausticRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 125px;" aria-label="IntermediateRinse: activate to sort column ascending">IntermediateRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 123px;" aria-label="AcidRecirculation: activate to sort column ascending">AcidRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 126px;" aria-label="IntermediateRinse: activate to sort column ascending">IntermediateRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="HeatSterilizeNoPulsing: activate to sort column ascending">HeatSterilizeNoPulsing</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="HeatSterilizePulsing: activate to sort column ascending">HeatSterilizePulsing</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="SecondSemiAutoRecirculation: activate to sort column ascending">SecondSemiAutoRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="SanitiserRecirculation: activate to sort column ascending">SanitiserRecirculation</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="FinalRinse: activate to sort column ascending">FinalRinse</th> <th class="sorting" tabindex="0" aria-controls="tblRandomSummary" rowspan="1" colspan="1" style="width: 0px; display: none;" aria-label="Idle: activate to sort column ascending">Idle</th> </tr> </thead> <tbody> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>Acid</td> <td>3.75 mins</td> <td>0</td> <td class="green-circle">0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="even"> <td tabindex="0" class="sorting_1">Engine001</td> <td>SemiAuto</td> <td>3.75 mins</td> <td class="green-circle">0</td> <td class="green-circle">0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>SemiAuto &amp; Acid</td> <td>3.75 mins</td> <td class="green-circle">0</td> <td class="green-circle">0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="even"> <td tabindex="0" class="sorting_1">Engine001</td> <td>No Wash</td> <td>4.13 mins</td> <td class="green-circle">0</td> <td class="green-circle">0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> <tr role="row" class="odd"> <td tabindex="0" class="sorting_1">Engine001</td> <td>Rinse</td> <td>4.44 mins</td> <td class="green-circle">0</td> <td class="green-circle">0</td> <td>0</td> <td>0</td> <td>0</td> <td style="display: none;">0</td> <td class="red-circle" style="display: none;">4</td> <td style="display: none;">0</td> <td style="display: none;">0</td> <td style="display: none;"></td> <td style="display: none;">0</td> </tr> </tbody> </table>中有schema_1.table_a,在同一群集上的数据库dev中有schema_2.table_b。如果我连接到test并编写查询:

dev schema.table引用突出显示(正确)为超出范围错误。

但是,如果我连接到数据库select * from schema_2.table_b并编写查询:

test没有错误突出显示,DataGrip提供自动填充参考。在运行时,查询不出意料地抛出错误,因为select * from schema_1.table_a不包含该架构或表。

我发现这个特别很奇怪,因为它只影响一个数据库连接。扩展此示例时,test表现得很奇怪,但testprod等都按预期运行,突出显示类似的超出范围错误。

我是否有意外更改的数据库范围设置?当我把它投入生产时,让我疯狂地试图调试代码。

删除Redshift连接并创建新连接不会影响行为;也许这与postgres / Redshift有关?

1 个答案:

答案 0 :(得分:0)

目前,DataGrip在控制台中对对象名称执行更广泛的查找。 它将不合格的名称解析为您已在数据源设置中配置的数据库/模式以及您已在控制台中连接的数据库/模式。

原因很简单:我们希望查询已经编写的默认模式,即使在切换模式时也要突出显示(想象所有代码一次变为黄色)。 但看起来它并不适合PG数据库。

我们想让它可配置。请观看DBE-6456