Skip to content

How do I get column names of a table? #908

@napalm272

Description

@napalm272

Hi, I want to get the column names of a table. This is what I'm doing now:

var selectQuery = 'SELECT * FROM "' + tableName + '" LIMIT 1';
pgClient.query(selectQuery, function(err, result){
    var columns = _.pluck(result.fields, 'name');
})

Wondering if there's a better way. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions