Hi,
How can I display the the columns in a view in vsql? The \d and \dv commands don't show the columns I have to keep selecting just one row (limit 1) to check the column names.
Thanks
Display View Column Names in vsql
Moderator: NorbertKrupa
Re: Display View Column Names in vsql
Hi!
Code: Select all
daniel=> select export_objects('','view_name');
Code: Select all
daniel=> select ordinal_position, column_name, data_type from view_columns where table_name = 'view_name' order by ordinal_position;
Re: Display View Column Names in vsql
Ok, thanks, sKwa. I was hoping there was a describe option like a describe table...
Re: Display View Column Names in vsql
Hi!
If you are using vsql you always can set an alias:
write it in '.vsqlrc' file to set it permanent
If you are using vsql you always can set an alias:
Code: Select all
daniel=> \set show_view 'select ordinal_position, column_name, data_type from view_columns where table_name = '
daniel=> :show_view 'my_view';
ordinal_position | column_name | data_type
------------------+-------------+-------------
1 | id | int
2 | name | varchar(80)
3 | salary | int
4 | dept | int
(4 rows)
Re: Display View Column Names in vsql
Thanks, sKwa! That's cool! I will use this solution
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Display View Column Names in vsql
#skwa: That is a really cool solution!
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.