204 PgsqlTable
get_table(AbstractDatasource nds,
string nname, *
hash opts);
211 parse_schema_name(
string nname, reference schema, reference name);
269 constructor(
string n_name,
bool n_unique,
hash n_cols, *
string n_tablespace) ;
277 private bool equalImpl(AbstractIndex ix);
281 string getRenameSql(
string table_name,
string new_name);
291 constructor(
string n, Columns c, ForeignConstraintTarget t) ;
298 softlist
getRenameSql(
string table_name,
string new_name);
337 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs) ;
341 string getNativeTypeString();
352 list getAddColumnSql(AbstractTable t);
368 list getModifySqlImpl(AbstractTable t, AbstractColumn col, *
hash opt);
386 private bool equalImpl(AbstractColumn c);
395 constructor(
string n,
string nt, *
string qt,
int sz,
bool nul, *
string dv, *
string cm, softint bs, softint n_scale) ;
399 string getNativeTypeString();
418 *
string getTablespace();
422 setTablespace(*
string ts);
426 bool setIndexBase(
string ix);
434 abstract AbstractIterator keyIterator();
437 getIndexSql(reference sql,
string name, *
hash opts);
535 softlist
getRenameSql(
string table_name,
string new_name);
568 constructor(
string n_name,
string n_src, *
string n_schemaname,
599 private bool equalImpl(AbstractFunctionBase t);
603 softlist
getRenameSql(
string table_name,
string new_name);
628 private bool equalImpl(AbstractFunctionBase t);
636 setName(
string new_name);
650 constructor(
string n,
string n_src,
string n_trigger) ;
660 const PgsqlSchemaDescriptionOptions = AbstractDatabase::SchemaDescriptionOptions + (
665 const PGSQL_TempSavepoint =
"qore_pgsql_tmp_savepoint";
668 const PgsqlReclaimSpaceOptions = ReclaimSpaceOptions + (
678 private list featuresImpl();
690 private *AbstractSequence getSequenceImpl(
string name);
693 private *AbstractView getViewImpl(
string name);
702 private *AbstractFunction getFunctionImpl(
string name);
705 private AbstractFunction getProcedureImpl(
string name);
708 static *
string getFunctionArgs(
string err, reference
src);
712 private list getDropSchemaSqlImpl(
hash schema_hash, *
hash opt);
715 private list getAlignSqlImpl(
hash schema_hash, *
hash opt);
719 private list listTablesImpl();
727 private list listFunctionsImpl();
733 private list listProceduresImpl();
736 private list listSequencesImpl();
739 private list listViewsImpl();
743 list listMaterializedViews();
747 ListIterator materializedViewIterator();
755 ListIterator typeIterator();
759 private string getCreateSqlImpl(
list l);
766 private hash getSchemaDescriptionOptions();
770 private hash getReclaimSpaceOptions();
774 private softint getNextSequenceValueImpl(
string name);
778 private softint getCurrentSequenceValueImpl(
string name);
782 private bool supportsSequencesImpl();
786 private bool supportsTypesImpl();
790 private bool supportsPackagesImpl();
794 private bool rebuildIndexImpl(
string name, *
hash options);
798 private computeStatisticsImpl(*
hash options);
802 private reclaimSpaceImpl(*
hash options);
806 private any tryExecArgsImpl(
string sql, *softlist args);
810 private any tryExecRawImpl(
string sql, *softlist args);
814 static any tryExecArgs(AbstractDatasource ds,
string sql, *softlist args);
817 static any tryExecRaw(AbstractDatasource ds,
string sql);
826 const PgsqlTypeMap = (
846 "interval": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
857 "time": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
858 "time with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
859 "time without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
860 "timetz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
861 "timestamp": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
862 "timestamp with time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
863 "timestamp without time zone": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
864 "timestamptz": (
"qore":
Type::Date,
"size":
SZ_OPT,
"size_range": (0, 6),
"default_size": 6,),
870 const PgsqlNameMap = (
871 "bit varying":
"varbit",
873 "character varying":
"varchar",
874 "char varying":
"varchar",
875 "double precision":
"float",
876 "time with time zone":
"timetz",
877 "time without time zone":
"time",
878 "timestamp with time zone":
"timestamptz",
879 "timestamp without time zone":
"timestamp",
883 const QoreTypeMap = (
885 "float":
"double precision",
897 const PgsqlTableDescriptionHashOptions = AbstractTable::TableDescriptionHashOptions + (
901 const PgsqlColumnDescOptions = AbstractTable::ColumnDescOptions;
903 const PgsqlIndexOptions = AbstractTable::IndexOptions;
905 const PgsqlConstraintOptions = AbstractTable::ConstraintOptions + PgsqlIndexOptions + (
909 const PgsqlTableCreationOptions = AbstractTable::TableCreationOptions + PgsqlConstraintOptions + (
913 const PgsqlAlignTableOptions = AbstractTable::AlignTableOptions + PgsqlTableCreationOptions;
919 string name = QoreTypeMap{args[0]} ?? args[0];
920 hash desc = PgsqlTypeMap{name};
921 string sql =
sprintf (
"cast (%s as %s", cve, name);
931 "code":
string (*
string cve, *
string arg) {
932 string sql = cve +
" over (";
934 sql +=
sprintf(
"partition by %s", arg);
940 "code":
string (
string arg1, any arg) {
941 return sprintf(
"to_char(%s, 'YYYY')", arg1);
945 "code":
string (
string arg1, any arg) {
946 return sprintf(
"to_char(%s, 'YYYY-MM')", arg1);
950 "code":
string (
string arg1, any arg) {
951 return sprintf(
"to_char(%s, 'YYYY-MM-DD')", arg1);
955 "code":
string (
string arg1, any arg) {
956 return sprintf(
"to_char(%s, 'YYYY-MM-DD HH24')", arg1);
962 "code":
string (*
string cve,
hash arg, reference psch) {
963 string sql =
sprintf(
"nextval('%s')", arg.seq);
972 "code":
string (*
string cve,
hash arg, reference psch) {
973 string sql =
sprintf(
"currval('%s')", arg.seq);
985 "placeholder":
"nextval(%v)",
989 "placeholder":
"currval(%v)",
997 "code":
string (*
string cve,
string arg) {
998 return sprintf(
"nextval('%s')", arg);
1004 "code":
string (*
string cve,
string arg) {
1005 return sprintf(
"currval('%s')", arg);
1028 string getSchemaName();
1032 *
string getTablespaceName();
1035 PgsqlFunction addTriggerFunction(
string tfname,
string src,
string trigger);
1039 bool hasArrayBind();
1042 private PgsqlFunction addTriggerFunctionUnlocked(
string tfname,
string src,
string trigger);
1046 string getSqlName();
1049 private hash getTableCreationOptions();
1052 private hash getTableDescriptionHashOptions();
1055 private hash getColumnDescOptions();
1058 private hash getIndexOptions();
1061 private hash getConstraintOptions();
1064 private hash getAlignTableOptions();
1068 private hash getColumnOperatorMap();
1072 private hash getInsertOperatorMap();
1076 private hash getRawUpdateOperatorMap();
1079 private bool checkExistenceImpl();
1082 private Columns describeImpl();
1088 private Indexes getIndexesImpl();
1091 private ForeignConstraints getForeignConstraintsImpl(*
hash opts);
1094 private Constraints getConstraintsImpl();
1097 private Triggers getTriggersImpl();
1101 private string getCreateTableSqlImpl(*
hash opt);
1104 private *
list getCreateMiscSqlImpl(*
hash opt,
bool cache);
1107 private *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
1111 private string getCreateSqlImpl(
list l);
1114 private string getRenameSqlImpl(
string new_name);
1117 private AbstractColumn addColumnImpl(
string cname,
hash opt,
bool nullable =
True);
1120 private AbstractPrimaryKey addPrimaryKeyImpl(
string cname,
hash ch, *
hash opt);
1123 private AbstractIndex addIndexImpl(
string iname,
bool enabled,
hash ch, *
hash opt);
1126 private AbstractForeignConstraint addForeignConstraintImpl(
string cname,
hash ch,
string table,
hash tch, *
hash opt);
1129 private AbstractCheckConstraint addCheckConstraintImpl(
string cname,
string src, *
hash opt);
1132 private AbstractUniqueConstraint addUniqueConstraintImpl(
string cname,
hash ch, *
hash opt);
1135 private AbstractTrigger addTriggerImpl(
string tname,
string src, *
hash opt);
1138 private bool tryInsertImpl(
string sql,
hash row);
1141 private hash getQoreTypeMapImpl();
1144 private hash getTypeMapImpl();
1148 private *
string getSqlValueImpl(any v);
1151 private bool emptyImpl();
1155 private clearImpl();
1158 private softlist getDropSqlImpl();
1161 private setupTableImpl(
hash desc, *
hash opt);
1165 private bool constraintsLinkedToIndexesImpl();
1169 private bool uniqueIndexCreatesConstraintImpl();
1173 private bool supportsTablespacesImpl();
1177 private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *
hash qh);
1181 private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *
hash qh, *
hash jch, *
hash ch, *
hash psch,
list coll);
1185 private any tryExecArgsImpl(
string sql, *softlist args);
1189 private any tryExecRawImpl(
string sql, *softlist args);
1193 private copyImpl(AbstractTable old);
1196 private *
hash doReturningImpl(
hash opt, reference sql,
list args);
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:563
class modeling a unique constraint
Definition: PgsqlSqlUtil.qm.dox.h:442
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:557
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:307
string sprintf(string fmt,...)
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:655
the PgsqlSqlUtil namespace contains all the objects in the PgsqlSqlUtil module
Definition: PgsqlSqlUtil.qm.dox.h:202
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:327
string getDropSqlForce()
returns a string that can be used to drop a type and all dependencies
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:583
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:215
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:646
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:259
string getRenameSql(string new_name)
returns a string that can be used to rename a type
number number(softnumber n)
represents a PostgreSQL-specific trigger function
Definition: PgsqlSqlUtil.qm.dox.h:641
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:332
*string tablespace
the tablespace name of the index
Definition: PgsqlSqlUtil.qm.dox.h:264
represents a PostgreSQL-specific numeric column
Definition: PgsqlSqlUtil.qm.dox.h:391
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:220
bool enabled
True if the constraint is enabled, False if not
Definition: PgsqlSqlUtil.qm.dox.h:447
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:1020
common base class for unique constraints
Definition: PgsqlSqlUtil.qm.dox.h:404
string src
the source of the type
Definition: PgsqlSqlUtil.qm.dox.h:223
represents a PostgreSQL-specific primary key constraint
Definition: PgsqlSqlUtil.qm.dox.h:496
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:1014
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:287
string getDropSql(*hash opt)
returns a string that can be used to drop a type
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:1017
*string tablespace
any tablespace for the unique key index
Definition: PgsqlSqlUtil.qm.dox.h:409
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:540
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:821
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:608
bool equal(PgsqlType type)
returns True if the types are equal