PostgresRelationalDialect
Class: PostgresRelationalDialect
Defined in: packages/postgres/src/relational/dialect.ts:63
PostgreSQL syntax of the relational layout: typed columns, information_schema introspection, advisory locks,
deferrable foreign keys, JSONB operations on a named column
Extends
Implements
RelationalDialect
Constructors
Constructor
new PostgresRelationalDialect():
PostgresRelationalDialect
Returns
PostgresRelationalDialect
Inherited from
Properties
binaryCollation
readonlybinaryCollation: "COLLATE \"C\""
Defined in: packages/postgres/src/dialect.ts:13
Binary collation
Implementation of
RelationalDialect.binaryCollation
Inherited from
PostgresDialect.binaryCollation
inlineForeignKeys
readonlyinlineForeignKeys:false=false
Defined in: packages/postgres/src/relational/dialect.ts:65
Foreign keys are added after the tables, deferrable
Implementation of
RelationalDialect.inlineForeignKeys
Methods
asNumber()
asNumber(
json):string
Defined in: packages/postgres/src/dialect.ts:52
Parameters
json
string
Returns
string
Implementation of
RelationalDialect.asNumber
Inherited from
asString()
asString(
json):string
Defined in: packages/postgres/src/dialect.ts:57
Parameters
json
string
Returns
string
Implementation of
RelationalDialect.asString
Inherited from
backfillTypes()
backfillTypes(
table):string
Defined in: packages/postgres/src/dialect.ts:191
Parameters
table
string
Returns
string
Implementation of
RelationalDialect.backfillTypes
Inherited from
bulkAssign()
bulkAssign(
table,assignments,values):string
Defined in: packages/postgres/src/dialect.ts:164
One step per jsonb_set, each reading the previous one (d0 is the row data): the SQL stays linear in size
Parameters
table
string
assignments
object[]
values
any[]
Returns
string
Implementation of
RelationalDialect.bulkAssign
Inherited from
castText()
castText(
expr):string
Defined in: packages/postgres/src/relational/dialect.ts:255
Parameters
expr
string
Returns
string
Implementation of
RelationalDialect.castText
checkIndex()
protectedcheckIndex(index):number
Defined in: packages/postgres/src/dialect.ts:242
Check index
Parameters
index
number
an array index written inside a JSON path literal
Returns
number
the validated index
Inherited from
checkKey()
protectedcheckKey(key):void
Defined in: packages/postgres/src/dialect.ts:219
Check key
Parameters
key
string
a key segment written inside a JSON path literal
Returns
void
Inherited from
checkPath()
protectedcheckPath(path):string[]
Defined in: packages/postgres/src/dialect.ts:230
Check path
Parameters
path
string[]
path segments written inside a JSON path literal
Returns
string[]
the validated segments
Inherited from
collectionItemCondition()
collectionItemCondition(
attr,index,field,valueParam):string
Defined in: packages/postgres/src/dialect.ts:151
Parameters
attr
string
index
number | undefined
field
string
valueParam
number
Returns
string
Implementation of
RelationalDialect.collectionItemCondition
Inherited from
PostgresDialect.collectionItemCondition
columnJsonItemCondition()
columnJsonItemCondition(
column,index,field,valueParam):string
Defined in: packages/postgres/src/relational/dialect.ts:328
Parameters
column
string
index
number
field
string
valueParam
number
Returns
string
Implementation of
RelationalDialect.columnJsonItemCondition
columnJsonMerge()
columnJsonMerge(
column,patch,args):string
Defined in: packages/postgres/src/relational/dialect.ts:290
Parameters
column
string
patch
Record<string, unknown>
args
unknown[]
Returns
string
Implementation of
RelationalDialect.columnJsonMerge
columnJsonRemoveItem()
columnJsonRemoveItem(
column,index):string
Defined in: packages/postgres/src/relational/dialect.ts:323
Parameters
column
string
index
number
Returns
string
Implementation of
RelationalDialect.columnJsonRemoveItem
columnJsonRemoveKey()
columnJsonRemoveKey(
column,param):string
Defined in: packages/postgres/src/relational/dialect.ts:296
Parameters
column
string
param
number
Returns
string
Implementation of
RelationalDialect.columnJsonRemoveKey
columnJsonSetItem()
columnJsonSetItem(
column,itemParam,index):string
Defined in: packages/postgres/src/relational/dialect.ts:315
Parameters
column
string
itemParam
number
index
number | undefined
Returns
string
Implementation of
RelationalDialect.columnJsonSetItem
columnJsonSetPath()
columnJsonSetPath(
column,path,valueParam):string
Defined in: packages/postgres/src/relational/dialect.ts:304
Nested jsonb_set: every parent of the path is made an object when missing (an existing object or array is kept)
Parameters
column
string
path
string[]
valueParam
number
Returns
string
Implementation of
RelationalDialect.columnJsonSetPath
columnJsonText()
columnJsonText(
column,path):string
Defined in: packages/postgres/src/relational/dialect.ts:275
Parameters
column
string
path
string[]
Returns
string
Implementation of
RelationalDialect.columnJsonText
columnJsonValue()
columnJsonValue(
column,path):string
Defined in: packages/postgres/src/relational/dialect.ts:280
Parameters
column
string
path
string[]
Returns
string
Implementation of
RelationalDialect.columnJsonValue
columnJsonValueOrNull()
columnJsonValueOrNull(
column,path):string
Defined in: packages/postgres/src/relational/dialect.ts:285
Parameters
column
string
path
string[]
Returns
string
Implementation of
RelationalDialect.columnJsonValueOrNull
columnType()
columnType(
type):string
Defined in: packages/postgres/src/relational/dialect.ts:73
Parameters
type
ColumnType
Returns
string
Implementation of
RelationalDialect.columnType
contains()
contains(
json,value):string
Defined in: packages/postgres/src/dialect.ts:72
Parameters
json
string
value
string | number | boolean
Returns
string
Implementation of
RelationalDialect.contains
Inherited from
countStoredTypes()
countStoredTypes(
table):string
Defined in: packages/postgres/src/dialect.ts:196
Parameters
table
string
Returns
string
Implementation of
RelationalDialect.countStoredTypes
Inherited from
PostgresDialect.countStoredTypes
createTable()
createTable(
table):string
Defined in: packages/postgres/src/dialect.ts:82
Parameters
table
string
Returns
string
Implementation of
RelationalDialect.createTable
Inherited from
decode()
decode(
value):any
Defined in: packages/postgres/src/dialect.ts:211
pg parses jsonb columns
Parameters
value
any
Returns
any
Implementation of
RelationalDialect.decode
Inherited from
describeSchema()
describeSchema(
client,tables):Promise<LiveSchema>
Defined in: packages/postgres/src/relational/dialect.ts:209
Parameters
client
tables
string[]
Returns
Promise<LiveSchema>
Implementation of
RelationalDialect.describeSchema
distinctFrom()
distinctFrom(
left,right):string
Defined in: packages/postgres/src/dialect.ts:67
Parameters
left
string
right
string
Returns
string
Implementation of
RelationalDialect.distinctFrom
Inherited from
hasStoredType()
hasStoredType():
string
Defined in: packages/postgres/src/dialect.ts:95
Returns
string
Implementation of
RelationalDialect.hasStoredType
Inherited from
increment()
increment(
entries,updateDate,args):string
Defined in: packages/postgres/src/dialect.ts:122
Parameters
entries
object[]
updateDate
string
args
any[]
Returns
string
Implementation of
RelationalDialect.increment
Inherited from
isForeignKeyViolation()
isForeignKeyViolation(
err): {constraint?:string; } |undefined
Defined in: packages/postgres/src/relational/dialect.ts:337
foreign_key_violation
Parameters
err
unknown
Returns
{ constraint?: string; } | undefined
Implementation of
RelationalDialect.isForeignKeyViolation
isObjectRow()
isObjectRow():
string
Defined in: packages/postgres/src/dialect.ts:203
Returns
string
Implementation of
RelationalDialect.isObjectRow
Inherited from
isType()
isType(
json,type):string
Defined in: packages/postgres/src/dialect.ts:47
Parameters
json
string
type
JSONType
Returns
string
Implementation of
RelationalDialect.isType
Inherited from
isUniqueViolation()
isUniqueViolation(
err):boolean
Defined in: packages/postgres/src/dialect.ts:90
unique_violation
Parameters
err
unknown
Returns
boolean
Implementation of
RelationalDialect.isUniqueViolation
Inherited from
PostgresDialect.isUniqueViolation
jsonParam()
jsonParam(
i):string
Defined in: packages/postgres/src/dialect.ts:21
Parameters
i
number
Returns
string
Implementation of
RelationalDialect.jsonParam
Inherited from
jsonText()
jsonText(
path):string
Defined in: packages/postgres/src/dialect.ts:26
Parameters
path
string[]
Returns
string
Implementation of
RelationalDialect.jsonText
Inherited from
jsonValue()
jsonValue(
path):string
Defined in: packages/postgres/src/dialect.ts:31
Parameters
path
string[]
Returns
string
Implementation of
RelationalDialect.jsonValue
Inherited from
jsonValueOrNull()
jsonValueOrNull(
path):string
Defined in: packages/postgres/src/dialect.ts:36
Parameters
path
string[]
Returns
string
Implementation of
RelationalDialect.jsonValueOrNull
Inherited from
PostgresDialect.jsonValueOrNull
keptType()
keptType(
mapParam):string
Defined in: packages/postgres/src/dialect.ts:100
Parameters
mapParam
number
Returns
string
Implementation of
RelationalDialect.keptType
Inherited from
keyText()
keyText(
key):string
Defined in: packages/postgres/src/dialect.ts:41
Parameters
key
string
Returns
string
Implementation of
RelationalDialect.keyText
Inherited from
like()
like(
text,pattern):string
Defined in: packages/postgres/src/dialect.ts:77
Parameters
text
string
pattern
string
Returns
string
Implementation of
RelationalDialect.like
Inherited from
liveType()
liveType(
row):ColumnType|undefined
Defined in: packages/postgres/src/relational/dialect.ts:82
Return the plan type of the column, undefined for an unknown type
Parameters
row
a row of information_schema.columns
Returns
ColumnType | undefined
the plan type of the column, undefined for an unknown type
placeholder()
placeholder(
i):string
Defined in: packages/postgres/src/dialect.ts:16
Parameters
i
number
Returns
string
Implementation of
RelationalDialect.placeholder
Inherited from
quote()
quote(
identifier):string
Defined in: packages/postgres/src/relational/dialect.ts:68
Parameters
identifier
string
Returns
string
Implementation of
RelationalDialect.quote
removeCollectionItem()
removeCollectionItem(
attr,index,updateDate):string
Defined in: packages/postgres/src/dialect.ts:145
Parameters
attr
string
index
number
updateDate
string
Returns
string
Implementation of
RelationalDialect.removeCollectionItem
Inherited from
PostgresDialect.removeCollectionItem
removeKey()
removeKey(
attribute,args):string
Defined in: packages/postgres/src/dialect.ts:116
Parameters
attribute
string
args
any[]
Returns
string
Implementation of
RelationalDialect.removeKey
Inherited from
renderContractStep()
renderContractStep(
step):string[]
Defined in: packages/postgres/src/relational/dialect.ts:141
Parameters
step
ContractStep
Returns
string[]
Implementation of
RelationalDialect.renderContractStep
renderOnlineStep()
renderOnlineStep(
step):OnlineStatements
Defined in: packages/postgres/src/relational/dialect.ts:116
The statements of a step on a table with rows and traffic: an index is built CONCURRENTLY after the DDL
transaction (and dropped when the build fails, IF NOT EXISTS would skip the invalid index next time), a foreign
key is added NOT VALID in the transaction and validated after it, so no ACCESS EXCLUSIVE lock outlives the
catalog update
Parameters
step
SchemaStep
Returns
OnlineStatements
Implementation of
RelationalDialect.renderOnlineStep
renderStep()
renderStep(
step):string[]
Defined in: packages/postgres/src/relational/dialect.ts:92
Parameters
step
SchemaStep
Returns
string[]
Implementation of
RelationalDialect.renderStep
schemaLock()
schemaLock(
name):string
Defined in: packages/postgres/src/relational/dialect.ts:250
Parameters
name
string
Returns
string
Implementation of
RelationalDialect.schemaLock
setCollectionItem()
setCollectionItem(
attr,itemParam,index,updateDate):string
Defined in: packages/postgres/src/dialect.ts:133
Parameters
attr
string
itemParam
number
index
number | undefined
updateDate
string
Returns
string
Implementation of
RelationalDialect.setCollectionItem
Inherited from
PostgresDialect.setCollectionItem
shallowMerge()
shallowMerge(
json,patch,args):string
Defined in: packages/postgres/src/dialect.ts:110
Parameters
json
string
patch
Record<string, any>
args
any[]
Returns
string
Implementation of
RelationalDialect.shallowMerge
Inherited from
timeText()
timeText(
expr,type):string
Defined in: packages/postgres/src/relational/dialect.ts:260
Parameters
expr
string
type
ColumnType
Returns
string
Implementation of
RelationalDialect.timeText
toJson()
toJson(
expr,type):string
Defined in: packages/postgres/src/relational/dialect.ts:267
Parameters
expr
string
type
ColumnType
Returns
string
Implementation of
RelationalDialect.toJson
typedAttribute()
typedAttribute(
text,json,type):string
Defined in: packages/postgres/src/dialect.ts:62
Parameters
text
string
json
string
type
"number" | "boolean"
Returns
string
Implementation of
RelationalDialect.typedAttribute
Inherited from
PostgresDialect.typedAttribute
uniqueViolation()
uniqueViolation(
err):UniqueViolation|undefined
Defined in: packages/postgres/src/relational/dialect.ts:348
unique_violation: the primary key constraints are named <table>_pkey
Parameters
err
unknown
Returns
UniqueViolation | undefined
Implementation of
RelationalDialect.uniqueViolation
withStoredType()
withStoredType(
json,type):string
Defined in: packages/postgres/src/dialect.ts:105
Parameters
json
string
type
string
Returns
string
Implementation of
RelationalDialect.withStoredType