Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search column_names in Vertica?

Tags:

search

vertica

Anyone know of a handy function to search through column_names in Vertica? From the documentation, it seems like \d only queries table_names. I'm looking for something like MySQL's information_schema.columns, but can't find any information about a similar table of meta-data.

Thanks!

like image 245
timssopomo Avatar asked Apr 06 '12 18:04

timssopomo


People also ask

How do I check my schema in vertica?

Each user session has a search path of schemas. Vertica uses this search path to find tables and user-defined functions (UDFs) that are unqualified by their schema name. You can use the CURRENT_SCHEMA function to display the name of the current schema (i.e., the first “valid” schema in the user's search path).

How is data stored in Vertica?

By default, Vertica stores data in unique locations on each node. Each location is in a directory in a file system that the node can access, and is often in the node's own file system. You can create a local storage location for a single node or for all nodes in the cluster.


2 Answers

In 5.1 if you have enough permissions you can do

SELECT * FROM v_catalog.columns;

to access columns's info, for some things you'll need to join with

v_catalog.tables
like image 156
Camilo Avatar answered Oct 29 '22 06:10

Camilo


The answer may differ depending on the version of Vertica you are using.

In the latest version, 5.1, there is a COLUMNS system table. Just from looking at the online documentation here seems to be the most useful columns with their types:

TABLE_SCHEMA VARCHAR
TABLE_NAME VARCHAR
DATA_TYPE VARCHAR

That should give you what you need. If your version doesn't have the system table, let me know what version you're running and I'll see what we can do.

like image 38
geoffrobinson Avatar answered Oct 29 '22 07:10

geoffrobinson