Selecting the schema from vs_sequences gives error

Moderator: NorbertKrupa

Post Reply
beth
Intermediate
Intermediate
Posts: 58
Joined: Tue Oct 01, 2013 12:42 pm

Selecting the schema from vs_sequences gives error

Post by beth » Fri Jan 24, 2014 4:30 am

Hey,

Does this seem odd? I can select all the columns from the vs_sequences table...

Code: Select all

dbadmin=> select * from vs_sequences limit 1;
        oid        |         name         |      schema       |       owner       | cache  | cycle | ordered | increment | minvalue |      maxvalue       | curvalue | table 
-------------------+----------------------+-------------------+-------------------+--------+-------+---------+-----------+----------+---------------------+----------+-------
 45035996273823302 | company_name_stg_seq | 45035996273719012 | 45035996273704962 | 250000 | f     | f       |         1 |        1 | 9223372036854775807 |   750000 |     0
(1 row)
But if I try to just select the schema column, I get an error?!?!

Code: Select all

dbadmin=> select schema from vs_sequences limit 1;
ERROR 4856:  Syntax error at or near "schema" at character 8
LINE 1: select schema from vs_sequences limit 1;
               ^
What am I doing wrong?

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: Selecting the schema from vs_sequences gives error

Post by JimKnicely » Fri Jan 24, 2014 4:48 am

Schema is a reserved word in Vertica. It is odd that they chose to use it as a column label.

Anyway, you can query it by enclosing it in double quotes:

Code: Select all

select "schema" from vs_sequences limit 1;
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

beth
Intermediate
Intermediate
Posts: 58
Joined: Tue Oct 01, 2013 12:42 pm

Re: Selecting the schema from vs_sequences gives error

Post by beth » Fri Jan 24, 2014 4:50 pm

Duh :roll: Thanks, Jim!

Post Reply

Return to “Vertica SQL”