Set search path for vsql on the command line

Moderator: NorbertKrupa

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

Set search path for vsql on the command line

Post by beth » Tue Apr 01, 2014 12:23 pm

Howdy,

Anyone know if we can set the search path of a user as a parameter setting of some sort when running a sql statement via vsql command line?

vql -u user_name -w user_password -c "select count(*) from table;"

I want to run the above command sometimes with a different search path for the user user_name...

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

Re: Set search path for vsql on the command line

Post by JimKnicely » Tue Apr 01, 2014 12:33 pm

Hi Beth,

You can include the SET SEARCH_PATH command in your vsql command...

Example:

Code: Select all

[dbadmin@rivers-vertica-1 ~]$ vsql -c "set search_path=sales,sales_stg;show search_path"
    name     |                     setting                      
-------------+---------------------------------------------------
 search_path | sales, sales_stg, v_catalog, v_monitor, v_internal
(1 row)
Jim Knicely

Image

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

Post Reply

Return to “vSQL”