218 PgsqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
225 parse_schema_name(
string nname, reference<string> schema, reference<string> name);
284 constructor(
string n_name,
bool n_unique,
hash n_cols, *
string n_tablespace) ;
294 bool equalImpl(AbstractIndex ix);
299 string getRenameSql(
string table_name,
string new_name);
309 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
316 softlist
getRenameSql(
string table_name,
string new_name);
355 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
359 string getNativeTypeString();
370 list getAddColumnSql(AbstractTable t);
387 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *
hash opt);
407 bool equalImpl(AbstractColumn c);
417 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale) ;
421 string getNativeTypeString();
440 *
string getTablespace();
444 setTablespace(*
string ts);
448 bool setIndexBase(
string ix);
456 abstract AbstractIterator keyIterator();
459 getIndexSql(reference<string> sql,
string name, *
hash opts);
557 softlist
getRenameSql(
string table_name,
string new_name);
594 constructor(
string n_name,
string n_src, *
string n_schemaname,
631 bool equalImpl(AbstractFunctionBase t);
636 softlist
getRenameSql(
string table_name,
string new_name);
665 bool equalImpl(AbstractFunctionBase t);
677 setName(
string new_name);
691 constructor(
string n,
string n_src,
string n_trigger) ;
701 const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
706 const PGSQL_TempSavepoint =
"qore_pgsql_tmp_savepoint";
709 const PgsqlReclaimSpaceOptions = ReclaimSpaceOptions + (
739 *AbstractSequence getSequenceImpl(
string name);
745 *AbstractView getViewImpl(
string name);
763 *AbstractFunction getFunctionImpl(
string name);
769 AbstractFunction getProcedureImpl(
string name);
773 static *
string getFunctionArgs(
string err, reference<string>
src);
792 list listTablesImpl();
803 list listFunctionsImpl();
812 list listProceduresImpl();
818 list listSequencesImpl();
824 list listViewsImpl();
829 list listMaterializedViews();
833 ListIterator materializedViewIterator();
841 ListIterator typeIterator();
847 string getCreateSqlImpl(
list l);
857 hash getSchemaDescriptionOptions();
864 hash getReclaimSpaceOptions();
871 softint getNextSequenceValueImpl(
string name);
878 softint getCurrentSequenceValueImpl(
string name);
885 bool supportsSequencesImpl();
892 bool supportsTypesImpl();
899 bool supportsPackagesImpl();
906 bool rebuildIndexImpl(
string name, *
hash options);
913 computeStatisticsImpl(*
hash options);
920 reclaimSpaceImpl(*
hash options);
927 auto tryExecArgsImpl(
string sql, *softlist args);
934 auto tryExecRawImpl(
string sql, *softlist args);
939 static auto tryExecArgs(AbstractDatasource ds,
string sql, *softlist args);
942 static auto tryExecRaw(AbstractDatasource ds,
string sql);
951 const PgsqlTypeMap = (
971 "interval": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
982 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
983 "time with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
984 "time without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
985 "timetz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
986 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
987 "timestamp with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
988 "timestamp without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
989 "timestamptz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
995 const PgsqlNameMap = (
996 "bit varying":
"varbit",
998 "character varying":
"varchar",
999 "char varying":
"varchar",
1000 "double precision":
"float",
1001 "time with time zone":
"timetz",
1002 "time without time zone":
"time",
1003 "timestamp with time zone":
"timestamptz",
1004 "timestamp without time zone":
"timestamp",
1008 const QoreTypeMap = (
1009 "integer":
"bigint",
1010 "float":
"double precision",
1011 "number":
"numeric",
1012 "string":
"varchar",
1013 "date":
"timestamp",
1022 const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
1026 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
1028 const PgsqlIndexOptions = AbstractTable::IndexOptions;
1030 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
1034 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
1038 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
1041 const PgsqlCopMap = (
1044 string name = QoreTypeMap{args[0]} ?? args[0];
1045 hash desc = PgsqlTypeMap{name};
1046 string sql =
sprintf (
"cast (%s as %s", cve, name);
1054 "code":
string (
string arg1,
auto arg) {
1055 return sprintf(
"to_char(%s, 'YYYY')", arg1);
1059 "code":
string (
string arg1,
auto arg) {
1060 return sprintf(
"to_char(%s, 'YYYY-MM')", arg1);
1064 "code":
string (
string arg1,
auto arg) {
1065 return sprintf(
"to_char(%s, 'YYYY-MM-DD')", arg1);
1069 "code":
string (
string arg1,
auto arg) {
1070 return sprintf(
"to_char(%s, 'YYYY-MM-DD HH24')", arg1);
1076 "code":
string (*
string cve,
hash arg, reference<hash> psch) {
1077 string sql =
sprintf(
"nextval('%s')", arg.seq);
1086 "code":
string (*
string cve,
hash arg, reference<hash> psch) {
1087 string sql =
sprintf(
"currval('%s')", arg.seq);
1094 "code":
string sub(
string arg1,
auto arg) {
1095 if (!PgsqlTruncDate.hasKey(arg));
1097 return sprintf(
"date_trunc(%s, %s)", PgsqlTruncDate{arg}, arg1);
1103 const PgsqlTruncDate = (
1116 "placeholder":
"nextval(%v)",
1120 "placeholder":
"currval(%v)",
1128 "code":
string (*
string cve,
string arg) {
1129 return sprintf(
"nextval('%s')", arg);
1135 "code":
string (*
string cve,
string arg) {
1136 return sprintf(
"currval('%s')", arg);
1159 string getSchemaName();
1163 *
string getTablespaceName();
1166 PgsqlFunction addTriggerFunction(
string tfname,
string src,
string trigger);
1170 bool hasArrayBind();
1175 PgsqlFunction addTriggerFunctionUnlocked(
string tfname,
string src,
string trigger);
1180 string getSqlName();
1185 hash getTableCreationOptions();
1191 hash getTableDescriptionHashOptions();
1197 hash getColumnDescOptions();
1203 hash getIndexOptions();
1209 hash getConstraintOptions();
1215 hash getAlignTableOptions();
1222 hash getColumnOperatorMapImpl();
1229 hash getInsertOperatorMap();
1236 hash getRawUpdateOperatorMap();
1242 bool checkExistenceImpl();
1248 Columns describeImpl();
1260 Indexes getIndexesImpl();
1266 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1272 Constraints getConstraintsImpl();
1278 Triggers getTriggersImpl();
1285 string getCreateTableSqlImpl(*
hash opt);
1291 *
list getCreateMiscSqlImpl(*
hash opt,
bool cache);
1297 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1304 string getCreateSqlImpl(
list l);
1310 string getRenameSqlImpl(
string new_name);
1316 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1322 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1328 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1334 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1340 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1346 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1352 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1358 bool tryInsertImpl(
string sql,
hash row);
1364 hash getQoreTypeMapImpl();
1370 hash getTypeMapImpl();
1377 *
string getSqlValueImpl(
auto v);
1396 softlist getDropSqlImpl();
1402 setupTableImpl(
hash desc, *
hash opt);
1409 bool constraintsLinkedToIndexesImpl();
1416 bool uniqueIndexCreatesConstraintImpl();
1423 bool supportsTablespacesImpl();
1430 doSelectLimitOnlyUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh);
1437 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh, *
hash jch, *
hash ch, *
hash psch,
list coll);
1444 auto tryExecArgsImpl(
string sql, *softlist args);
1451 auto tryExecRawImpl(
string sql, *softlist args);
1458 copyImpl(AbstractTable old);
1464 *
hash doReturningImpl(
hash opt, reference<string> sql,
list args);
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:589
class modeling a unique constraint
Definition: PgsqlSqlUtil.qm.dox.h:464
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:583
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:325
string sprintf(string fmt,...)
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:696
the PgsqlSqlUtil namespace contains all the objects in the PgsqlSqlUtil module
Definition: PgsqlSqlUtil.qm.dox.h:216
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:345
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:613
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:229
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:687
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:274
number number(softnumber n)
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:682
string getCreateSql(*hash opt)
returns a string that can be used to create the type in the database
int byte_size
byte size of the column
Definition: PgsqlSqlUtil.qm.dox.h:350
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:279
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:413
string getRenameSql(string new_name, *hash opt)
returns a string that can be used to rename a type
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:234
bool enabled
True if the constraint is enabled, False if not
Definition: PgsqlSqlUtil.qm.dox.h:469
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:1151
common base class for unique constraints
Definition: PgsqlSqlUtil.qm.dox.h:426
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:237
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:518
constructor(string n_name, string n_src)
creates the type from the supplied arguments
string string(softstring str, *string enc)
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:1145
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:305
string getDropSql(*hash opt)
returns a string that can be used to drop the function from the database
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:1148
*string tablespace
any tablespace for the unique key index
Definition: PgsqlSqlUtil.qm.dox.h:431
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:562
PgsqlTable get_table(AbstractDatasource nds, string nname, *hash opts)
returns a PgsqlTable object corresponding to the arguments
provides the PostgreSQL-specific implementation of the SqlUtil::AbstractTable interface ...
Definition: PgsqlSqlUtil.qm.dox.h:946
PgsqlDatabase get_database(AbstractDatasource nds, *hash opts)
returns a PgsqlDatabase object corresponding to the arguments
represents a PostgreSQL-specific function
Definition: PgsqlSqlUtil.qm.dox.h:641
bool equal(PgsqlType type)
returns True if the types are equal