簡體   English   中英

為什么我無法獲取 psql 中的特定列

[英]Why I am not able to get the specific column in psql

我的 psql 數據庫中有一個名為cls的表,用戶名為cls然后嘗試從現有表 [name: test] 中獲取特定列,但我無法檢索該表。

片段如下:

psql -U cls
    
cls # select * from test;
      name |     
    ip  | 
    user   |  
    password   | 
    group |        
    created_on         
-----------+--------+------+--------------+--------+----------------------------
     server | 1.1.1.1   | test | pwd         | gp1   | 2022-08-04 13:55:00.765548
cls # select ip from test where name='server';
LINE 1: select ip from test where name='server';
               ^
HINT:  Perhaps you meant to reference the column "test.
ip".

cls # select test.ip from test where name='server';
LINE 1: select ip from test where name='server';
               ^
HINT:  Perhaps you meant to reference the column "test.
ip".

cls # select t.ip from test t;
LINE 1: select t.ip from test t;
               ^
HINT:  Perhaps you meant to reference the column "t.
ip".

我嘗試了雙引號和單引號,但沒有運氣。

正如錯誤消息所說,您的列不稱為ip ,而是稱為ip - 注意 i 之前的“有趣”字符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM