how to access a table containing . in its name

I have created a database schema as "mytest.us" and inside this schema, I have created a table "a.b.c".

When I do

 

select * from select * from "mytest.us"."a.b.c"; 
year
| mydata
------+--------
2011 | test1
2010 | test1(2 rows)

but when I do

 

\\! $TARGET/sql -p $PGPORT -d $PGDBNAME -c "select * from "mytest.us"."a.b.c"";

sh: -c: line 1: syntax error: unexpected end of file

 

Comments

  • Hi ,

    Its shell related  issue , try 

     

    \\! $TARGET/sql -p $PGPORT -d $PGDBNAME -c "select * from \"mytest.us\".\"a.b.c\"";

     

    Below work for me :

    [dbadmin@mydphdb0184 ~]$ echo "select * from \"mytest.us\".\"a.b.c\";"|vsql dbadmin
    Password:
    a
    ---
    (0 rows)

    [dbadmin@mydphdb0184 ~]$

     

     

    I hope you will find it useful.

     

    Thanks 

     

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file