Viewing function definitions in Vertica

I don’t know if you have tried this. But I did try to read function definition from the system tables in Vertica. I used the table called USER_FUNCTIONS which is a table in the V_CATALOG system schema. More details can be found here: https://my.vertica.com/docs/6.1.x/HTML/index.htm#15021.htm But unfortunately when I try and do something like this: vertdeva01:20130604-113434 > select function\_definition from v\_catalog.user\_functions where schema\_name='calc' and function\_name='getCYForDate'; \---------------------------------------------------------------------------------------------------------------------------------- RETURN to\_date(concat(((((date\_part('year', (processDate)::timestamp))::int - CASE WHEN ((date\_part('month', (processDate)::time (1 row) If you notice the function definition is only partly visible. The rest of it gets truncated. I don’t know how to set it right. If you know how, feel free to comment on this post. ...

June 5, 2013 · 2 min · 267 words

VSQL extract data into file

Hey there! So you use Vertica and vsql to interact with your tables. Ever had those times when you wanted to take stuff from your table and paste it into Microsoft Excel for sending it off to someone not so technically acquainted with Vertica? You could write a script to do that for you. But if you just had to do it within a vsql session you also have options to do it. ...

May 30, 2013 · 1 min · 157 words

Vertica DELETE columns from one table using data from another

My colleague had an issue in Vertica. He had a set of values in table 1 to be deleted based on the records in a table table2. I didn’t think this would be easy considering VERTICA didn’t support joins when doing deletes unlike MYSQL. But they do have something else. Let me take you through the steps I followed. I created the following table in which I have records create table eakan (sec\_id int, nameid int, date date); insert into public.eakan values(1,1,'2013-05-20'); insert into public.eakan values(2,1,'2013-05-20'); insert into public.eakan values(3,1,'2013-05-20'); insert into public.eakan values(1,1,'2013-05-21'); insert into public.eakan values(2,1,'2013-05-21'); insert into public.eakan values(3,1,'2013-05-21'); ```I also created another table using the records of which I have to delete records in the earlier one.``` create table eakan\_del (sec\_id int, nameid int, date date); insert into public.eakan\_del values(1,1,'2013-05-21'); commit; ```I was naive initially and did something like this: First try:``` DELETE from eakan WHERE eakan.sec\_id IN (select eakan\_del.sec\_id from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid) and eakan.date IN (select eakan\_del.date from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid) and eakan.nameid in (select eakan\_del.nameid from eakan\_del where eakan\_del.sec\_id=eakan.sec\_id and eakan\_del.date=eakan.date and eakan\_del.nameid=eakan.nameid); Then I realized there should be another way and used some documentation of Vertica and also checked out Vertica Forums if something was available. ...

May 30, 2013 · 2 min · 275 words