Skip to content

View Operations

Operation: createView

pgm.createView( viewName, options, definition )

IMPORTANT

Create a new view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the new view
optionsobjectCheck below for available options
definitionstringSQL of SELECT statement

Options

OptionTypeDescription
temporarybooleanadds TEMPORARY clause
replacebooleanadds OR REPLACE clause
recursivebooleanadds RECURSIVE clause
columnsstring or arrayuse if you want to name columns differently then inferred from definition
optionsobjectkey value pairs of View Options
checkOptionstringCASCADED or LOCAL

Reverse Operation: dropView

pgm.dropView( viewName, options )

IMPORTANT

Drop a view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to delete
optionsobjectCheck below for available options

Options

OptionTypeDescription
ifExistsbooleandrops view only if it exists
cascadebooleandrops also dependent objects

Operation: alterView

pgm.alterView( viewName, options )

IMPORTANT

Alter a view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to alter
optionsobjectCheck below for available options

Options

OptionTypeDescription
checkOptionstringCASCADED, LOCAL or null to reset
optionsobjectkey value (null to reset) pairs of View Options

Operation: alterViewColumn

pgm.alterViewColumn( viewName, columnName, options )

IMPORTANT

Alter a view column - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to alter
columnNamestringname of the column to alter
optionsobjectCheck below for available options

Options

OptionTypeDescription
defaultstringdefault value of column

Operation: renameView

pgm.renameView( viewName, newViewName )

IMPORTANT

Rename a view - postgres docs

Arguments

NameTypeDescription
viewNamestringold name of the view
newViewNamestringnew name of the view