PostgreSQL ERROR: 42P01: relation “[Table]” does not exist

前端 未结 3 1674
灰色年华
灰色年华 2021-02-13 17:27

I\'m having this strange problem using PostgreSQL 9.3 with tables that are created using qoutes. For instance, if I create a table using qoutes:

create table \"T         


        
3条回答
  •  日久生厌
    2021-02-13 18:28

    A string function used to suitably quote identifiers in an SQL statement string is quote_ident(), which references a good example (used in conjunction with related quote_literal()).

    To use your example, and mix in other results:

    select
       quote_ident(table_schema) as table_schema,
       quote_ident(table_name) as table_name
    ...
    
     table_schema |    table_name
    --------------+------------------
     ...
     public       | good_name
     public       | "table"
     public       | some_table
     public       | "something else"
     public       | "Tom's work"
     public       | "TEST"
     ...
    

提交回复
热议问题