Search code examples
sqlvertica

How do I find the creator of a table in Vertica ? (Given that the owner was changed)


The owner of a table in a Vertica was changed using the command below:

ALTER TABLE t33 OWNER TO Bob;

Now, I want to know who created this table, since the owner is different from the creator, where do I find that ?

P.S. I tried to go through the log history, but it doesn't hold "create table"statements.


Solution

  • What about...

    SQL> CREATE TABLE public.stack1 ( ID INTEGER ) ;
    CREATE TABLE
    SQL> ALTER TABLE public.stack1 OWNER TO mauro ;
    ALTER TABLE
    SQL> SELECT start_timestamp, user_name, request  
         FROM v_monitor.query_requests 
         WHERE request_type = 'DDL' 
         ORDER BY 1 DESC LIMIT 2;
            start_timestamp        | user_name |                   request                   
    -------------------------------+-----------+---------------------------------------------
     2018-05-09 14:13:50.57512-04  | dbadmin   | ALTER TABLE public.stack1 OWNER TO mauro ;
     2018-05-09 14:13:06.348753-04 | dbadmin   | CREATE TABLE public.stack1 ( ID INTEGER ) ;
    (2 rows)