214 PgsqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
221 parse_schema_name(
string nname, reference<string> schema, reference<string> name);
280 constructor(
string n_name,
bool n_unique,
hash n_cols, *
string n_tablespace) ;
290 bool equalImpl(AbstractIndex ix);
295 string getRenameSql(
string table_name,
string new_name);
305 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
312 softlist
getRenameSql(
string table_name,
string new_name);
351 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
355 string getNativeTypeString();
366 list getAddColumnSql(AbstractTable t);
383 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *
hash opt);
403 bool equalImpl(AbstractColumn c);
413 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale) ;
417 string getNativeTypeString();
436 *
string getTablespace();
440 setTablespace(*
string ts);
444 bool setIndexBase(
string ix);
452 abstract AbstractIterator keyIterator();
455 getIndexSql(reference<string> sql,
string name, *
hash opts);
553 softlist
getRenameSql(
string table_name,
string new_name);
590 constructor(
string n_name,
string n_src, *
string n_schemaname,
627 bool equalImpl(AbstractFunctionBase t);
632 softlist
getRenameSql(
string table_name,
string new_name);
661 bool equalImpl(AbstractFunctionBase t);
673 setName(
string new_name);
687 constructor(
string n,
string n_src,
string n_trigger) ;
697 const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
702 const PGSQL_TempSavepoint =
"qore_pgsql_tmp_savepoint";
705 const PgsqlReclaimSpaceOptions = ReclaimSpaceOptions + (
735 *AbstractSequence getSequenceImpl(
string name);
741 *AbstractView getViewImpl(
string name);
759 *AbstractFunction getFunctionImpl(
string name);
765 AbstractFunction getProcedureImpl(
string name);
769 static *
string getFunctionArgs(
string err, reference<string>
src);
788 list listTablesImpl();
799 list listFunctionsImpl();
808 list listProceduresImpl();
814 list listSequencesImpl();
820 list listViewsImpl();
825 list listMaterializedViews();
829 ListIterator materializedViewIterator();
837 ListIterator typeIterator();
843 string getCreateSqlImpl(
list l);
853 hash getSchemaDescriptionOptions();
860 hash getReclaimSpaceOptions();
867 softint getNextSequenceValueImpl(
string name);
874 softint getCurrentSequenceValueImpl(
string name);
881 bool supportsSequencesImpl();
888 bool supportsTypesImpl();
895 bool supportsPackagesImpl();
902 bool rebuildIndexImpl(
string name, *
hash options);
909 computeStatisticsImpl(*
hash options);
916 reclaimSpaceImpl(*
hash options);
923 auto tryExecArgsImpl(
string sql, *softlist args);
930 auto tryExecRawImpl(
string sql, *softlist args);
935 static auto tryExecArgs(AbstractDatasource ds,
string sql, *softlist args);
938 static auto tryExecRaw(AbstractDatasource ds,
string sql);
947 const PgsqlTypeMap = (
967 "interval": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
978 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
979 "time with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
980 "time without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
981 "timetz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
982 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
983 "timestamp with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
984 "timestamp without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
985 "timestamptz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
991 const PgsqlNameMap = (
992 "bit varying":
"varbit",
994 "character varying":
"varchar",
995 "char varying":
"varchar",
996 "double precision":
"float",
997 "time with time zone":
"timetz",
998 "time without time zone":
"time",
999 "timestamp with time zone":
"timestamptz",
1000 "timestamp without time zone":
"timestamp",
1004 const QoreTypeMap = (
1005 "integer":
"bigint",
1006 "float":
"double precision",
1007 "number":
"numeric",
1008 "string":
"varchar",
1009 "date":
"timestamp",
1018 const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
1022 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
1024 const PgsqlIndexOptions = AbstractTable::IndexOptions;
1026 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
1030 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
1034 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
1040 string name = QoreTypeMap{args[0]} ?? args[0];
1041 hash desc = PgsqlTypeMap{name};
1042 string sql =
sprintf (
"cast (%s as %s", cve, name);
1050 "code":
string (
string arg1,
auto arg) {
1051 return sprintf(
"to_char(%s, 'YYYY')", arg1);
1055 "code":
string (
string arg1,
auto arg) {
1056 return sprintf(
"to_char(%s, 'YYYY-MM')", arg1);
1060 "code":
string (
string arg1,
auto arg) {
1061 return sprintf(
"to_char(%s, 'YYYY-MM-DD')", arg1);
1065 "code":
string (
string arg1,
auto arg) {
1066 return sprintf(
"to_char(%s, 'YYYY-MM-DD HH24')", arg1);
1072 "code":
string (*
string cve,
hash arg, reference<hash> psch) {
1073 string sql =
sprintf(
"nextval('%s')", arg.seq);
1082 "code":
string (*
string cve,
hash arg, reference<hash> psch) {
1083 string sql =
sprintf(
"currval('%s')", arg.seq);
1090 "code":
string sub(
string arg1,
auto arg) {
1091 if (!PgsqlTruncDate.hasKey(arg));
1093 return sprintf(
"date_trunc(%s, %s)", PgsqlTruncDate{arg}, arg1);
1099 const PgsqlTruncDate = (
1112 "placeholder":
"nextval(%v)",
1116 "placeholder":
"currval(%v)",
1124 "code":
string (*
string cve,
string arg) {
1125 return sprintf(
"nextval('%s')", arg);
1131 "code":
string (*
string cve,
string arg) {
1132 return sprintf(
"currval('%s')", arg);
1155 string getSchemaName();
1159 *
string getTablespaceName();
1162 PgsqlFunction addTriggerFunction(
string tfname,
string src,
string trigger);
1166 bool hasArrayBind();
1171 PgsqlFunction addTriggerFunctionUnlocked(
string tfname,
string src,
string trigger);
1176 string getSqlName();
1181 hash getTableCreationOptions();
1187 hash getTableDescriptionHashOptions();
1193 hash getColumnDescOptions();
1199 hash getIndexOptions();
1205 hash getConstraintOptions();
1211 hash getAlignTableOptions();
1218 hash getColumnOperatorMap();
1225 hash getInsertOperatorMap();
1232 hash getRawUpdateOperatorMap();
1238 bool checkExistenceImpl();
1244 Columns describeImpl();
1256 Indexes getIndexesImpl();
1262 ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1268 Constraints getConstraintsImpl();
1274 Triggers getTriggersImpl();
1281 string getCreateTableSqlImpl(*
hash opt);
1287 *
list getCreateMiscSqlImpl(*
hash opt,
bool cache);
1293 *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1300 string getCreateSqlImpl(
list l);
1306 string getRenameSqlImpl(
string new_name);
1312 AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1318 AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1324 AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1330 AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1336 AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1342 AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1348 AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1354 bool tryInsertImpl(
string sql,
hash row);
1360 hash getQoreTypeMapImpl();
1366 hash getTypeMapImpl();
1373 *
string getSqlValueImpl(
auto v);
1392 softlist getDropSqlImpl();
1398 setupTableImpl(
hash desc, *
hash opt);
1405 bool constraintsLinkedToIndexesImpl();
1412 bool uniqueIndexCreatesConstraintImpl();
1419 bool supportsTablespacesImpl();
1426 doSelectLimitOnlyUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh);
1433 doSelectOrderByWithOffsetSqlUnlockedImpl(reference<string> sql, reference<list> args, *
hash qh, *
hash jch, *
hash ch, *
hash psch,
list coll);
1440 auto tryExecArgsImpl(
string sql, *softlist args);
1447 auto tryExecRawImpl(
string sql, *softlist args);
1454 copyImpl(AbstractTable old);
1460 *
hash doReturningImpl(
hash opt, reference<string> sql,
list args);
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:585
class modeling a unique constraint
Definition: PgsqlSqlUtil.qm.dox.h:460
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:579
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:321
string sprintf(string fmt,...)
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:692
the PgsqlSqlUtil namespace contains all the objects in the PgsqlSqlUtil module
Definition: PgsqlSqlUtil.qm.dox.h:212
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:341
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:609
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:225
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:683
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:270
number number(softnumber n)
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:678
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:346
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:275
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:409
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:230
bool enabled
True if the constraint is enabled, False if not
Definition: PgsqlSqlUtil.qm.dox.h:465
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:1147
common base class for unique constraints
Definition: PgsqlSqlUtil.qm.dox.h:422
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:233
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:514
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:1141
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:301
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:1144
*string tablespace
any tablespace for the unique key index
Definition: PgsqlSqlUtil.qm.dox.h:427
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:558
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:942
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:637
bool equal(PgsqlType type)
returns True if the types are equal