Page 1 of 1

Set search path for vsql on the command line

Posted: Tue Apr 01, 2014 12:23 pm
by beth
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...

Re: Set search path for vsql on the command line

Posted: Tue Apr 01, 2014 12:33 pm
by JimKnicely
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)