MCPcopy Create free account
hub / github.com/documentdb/documentdb / CreateValueRteForInsert

Function CreateValueRteForInsert

pg_documentdb/src/commands/insert.c:1783–1821  ·  view source on GitHub ↗

Build RangeTblEntry for values */

Source from the content-addressed store, hash-verified

1781
1782/* Build RangeTblEntry for values */
1783static inline RangeTblEntry *
1784CreateValueRteForInsert(MongoCollection *collection, List *valuesLists)
1785{
1786 /* Build the VALUES RTE */
1787 List *valuesColNames = list_make3(makeString("shard_key_value"),
1788 makeString("object_id"),
1789 makeString("document"));
1790
1791 if (collection->mongoDataCreationTimeVarAttrNumber != -1)
1792 {
1793 valuesColNames = lappend(valuesColNames, makeString("creation_time"));
1794 }
1795
1796 RangeTblEntry *valuesRte = makeNode(RangeTblEntry);
1797 valuesRte->rtekind = RTE_VALUES;
1798 valuesRte->alias = valuesRte->eref = makeAlias("values", valuesColNames);
1799 valuesRte->lateral = false;
1800 valuesRte->inFromCl = true;
1801 valuesRte->values_lists = valuesLists;
1802 valuesRte->inh = false;
1803
1804 /* Set column types and widths */
1805 if (collection->mongoDataCreationTimeVarAttrNumber != -1)
1806 {
1807 valuesRte->coltypes = list_make4_oid(INT8OID, BsonTypeId(), BsonTypeId(),
1808 TIMESTAMPTZOID);
1809 valuesRte->coltypmods = list_make4_int(-1, -1, -1, -1);
1810 valuesRte->colcollations = list_make4_oid(InvalidOid, InvalidOid, InvalidOid,
1811 InvalidOid);
1812 }
1813 else
1814 {
1815 valuesRte->coltypes = list_make3_oid(INT8OID, BsonTypeId(), BsonTypeId());
1816 valuesRte->coltypmods = list_make3_int(-1, -1, -1);
1817 valuesRte->colcollations = list_make3_oid(InvalidOid, InvalidOid, InvalidOid);
1818 }
1819
1820 return valuesRte;
1821}
1822
1823
1824/* Build targetList for insert */

Callers 2

CreateInsertQueryFunction · 0.85

Calls 1

BsonTypeIdFunction · 0.85

Tested by

no test coverage detected