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);
318 list 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) ;
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) ;
483 list getRenameSql(
string table_name,
string new_name);
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);
616 constructor(
string n,
string n_src, *
string a) ;
628 private bool equalImpl(AbstractFunctionBase t);
650 constructor(
string n,
string n_src,
string n_trigger) ;
665 const PGSQL_TempSavepoint =
"qore_pgsql_tmp_savepoint";
675 constructor(AbstractDatasource nds, *
hash opts) ;
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);
736 private list listSequencesImpl();
739 private list listViewsImpl();
814 static any
tryExecArgs(AbstractDatasource
ds,
string sql, *softlist args);
817 static any
tryExecRaw(AbstractDatasource
ds,
string sql);
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,),
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",
885 "float":
"double precision",
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;
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);
1024 constructor(AbstractDatasource nds,
string nname, *
hash opts) ;
1035 PgsqlFunction addTriggerFunction(
string tfname,
string src,
string trigger);
1042 private PgsqlFunction addTriggerFunctionUnlocked(
string tfname,
string src,
string trigger);
1049 private hash getTableCreationOptions();
1052 private hash getTableDescriptionHashOptions();
1055 private hash getColumnDescOptions();
1058 private hash getIndexOptions();
1061 private hash getConstraintOptions();
1064 private hash getAlignTableOptions();
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();
1107 private *
list getAlignSqlImpl(AbstractTable table, *
hash opt);
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();
1151 private bool emptyImpl();
1158 private softlist getDropSqlImpl();
1161 private setupTableImpl(
hash desc, *
hash opt);
1193 private copyImpl(AbstractTable old);
1196 private *
hash doReturningImpl(
hash opt, reference sql,
list args);
const PgsqlIopMap
a hash of default value operator descriptions for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:982
const PgsqlReclaimSpaceOptions
Options for reclaimSpace()
Definition: PgsqlSqlUtil.qm.dox.h:668
*string viewowner
Owner of the view.
Definition: PgsqlSqlUtil.qm.dox.h:563
class modeling a unique constraint
Definition: PgsqlSqlUtil.qm.dox.h:442
bool isEnabled()
returns True if the constraint is enabled, False if not
private bool supportsPackagesImpl()
returns True if the database supports packages
*string getTablespaceName()
returns the data tablespace name for the table or NOTHING if none is known
represents a PostgreSQL view
Definition: PgsqlSqlUtil.qm.dox.h:557
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
represents a PostgreSQL-specific check constraint
Definition: PgsqlSqlUtil.qm.dox.h:307
string sprintf(string fmt,...)
list listTypes()
returns a list of string type names in the database
bool hasArrayBind()
returns False because the pgsql driver does not support array binds / bulk DML operations ...
private list listProceduresImpl()
since PostgreSQL only supports functions, this method is identical to listFunctionsImpl() ...
provides the PostgreSQL-specific implementation of the AbstractDatabase interface ...
Definition: PgsqlSqlUtil.qm.dox.h:655
private bool supportsTablespacesImpl()
returns True if the database support tablespaces
private bool uniqueIndexCreatesConstraintImpl()
returns True if the database automatically creates a unique constraint when a unique index is created...
string getRenameSql(string new_name)
returns a string that can be used to rename the sequence in the database
private bool constraintsLinkedToIndexesImpl()
returns True if the database links constraints to indexes (ie dropping the constraint drops the index...
string getCreateSql(*hash opt)
returns a string that can be used to create the sequence in the database
constructor(string n, string n_src)
creates the constraint from the supplied arguments
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
the PgsqlSqlUtil namespace contains all the objects in the PgsqlSqlUtil module
Definition: PgsqlSqlUtil.qm.dox.h:202
private hash getRawUpdateOperatorMap()
returns the raw (default) update operator map for this object
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the index in the database
represents a PostgreSQL-specific column
Definition: PgsqlSqlUtil.qm.dox.h:327
const PgsqlNameMap
maps from verbose type names to simple type names
Definition: PgsqlSqlUtil.qm.dox.h:870
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
ListIterator materializedViewIterator()
returns an iterator listing the string materialized view names in the database
setTablespace(*string ts)
sets or clears the tablespace name
string getDropSqlForce()
returns a string that can be used to drop a type and all dependencies
bool setIndexBase(string ix)
sets the supporting index name
represents a PostgreSQL-specific trigger
Definition: PgsqlSqlUtil.qm.dox.h:583
softlist getCreateSql(*hash opt)
returns a string that can be used to create the function in the database
setName(string new_name)
sets the new name of the function
represents a PostgreSQL type
Definition: PgsqlSqlUtil.qm.dox.h:215
private clearImpl()
clears PostgreSQL-specific table information
private string getCreateSqlImpl(list l)
returns a string that can be used to create the table in the database
private hash getColumnOperatorMap()
returns the column operator map for this object
PgsqlColumn memberGate(string k)
returns the PgsqlColumn value of the given key if it exists, otherwise throws a KEY-ERROR exception ...
string trigger
trigger name
Definition: PgsqlSqlUtil.qm.dox.h:646
private bool equalImpl(AbstractFunctionBase t)
returns True if the argument is equal to the current object, False if not
static any tryExecArgs(AbstractDatasource ds, string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
represents a PostgreSQL-specific index
Definition: PgsqlSqlUtil.qm.dox.h:259
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the constraint
const PgsqlTableDescriptionHashOptions
extends SqlUtil::AbstractTable::TableDescriptionHashOptions with "functions" for table functions requ...
Definition: PgsqlSqlUtil.qm.dox.h:897
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
private any tryExecArgsImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs)
creates the column from the supplied arguments
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 getCreateSql(*hash opt)
returns a string that can be used to create the view in the database
*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
getIndexSql(reference sql, string name, *hash opts)
adds index options onto the sql creation string
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
private hash getInsertOperatorMap()
returns the insert operator map for this object
const QoreTypeMap
maps qore type names to PostgreSQL type names
Definition: PgsqlSqlUtil.qm.dox.h:883
private doSelectOrderByWithOffsetSqlUnlockedImpl(reference sql, reference args, *hash qh, *hash jch, *hash ch, *hash psch, list coll)
processes a string for use in SQL select statements when there is an "order by" and "offset" argument...
private computeStatisticsImpl(*hash options)
compute statistics implementation. See SqlUtil::AbstractDatabase::computeStatistics() ...
string getNativeTypeString()
returns a string giving the native type of the column
static any tryExecRaw(AbstractDatasource ds, string sql)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
constructor(*string ts)
creates the constraint with an optional tablespace name
string getSchemaName()
returns the schema name
string getSqlName()
returns the name of the table to be used in SQL (with a possible qualifiers for schema, etc)
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
constructor(string n_name, number n_start=1, number n_increment=1, *softnumber n_end)
creates the object from the arguments
string name
the name of the type
Definition: PgsqlSqlUtil.qm.dox.h:220
softlist getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the trigger in the database
private doSelectLimitOnlyUnlockedImpl(reference sql, reference args, *hash qh)
processes a string for use in SQL select statements when there is a "limit" argument, but no "orderby" or "offset" arguments
static string getCreateSql(list l)
returns a string that can be used to create the schema in the database
private bool supportsSequencesImpl()
returns True if the database supports sequences
string getRenameSql(AbstractTable t, string new_name)
returns a string that can be used to rename the column
private softint getCurrentSequenceValueImpl(string name)
returns the last value issued for the given sequence in the current session
bool enabled
True if the constraint is enabled, False if not
Definition: PgsqlSqlUtil.qm.dox.h:447
const PgsqlTypeMap
maps PostgreSQL type names to type configurations
Definition: PgsqlSqlUtil.qm.dox.h:826
string getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the index in the database
constructor()
creates an empty primary key object
private any tryExecRawImpl(string sql, *softlist args)
tries to execute a command so that if an error occurs the current transaction status is not lost ...
private string getCreateSqlImpl(list l)
returns a string that can be used to create the schema in the database
Functions triggerFunctions
contains any trigger functions supporting triggers on the table
Definition: PgsqlSqlUtil.qm.dox.h:1020
private *string getSqlValueImpl(any v)
returns a string for use in SQL queries representing the DB-specific value of the argument; returns N...
common base class for unique constraints
Definition: PgsqlSqlUtil.qm.dox.h:404
const PgsqlSchemaDescriptionOptions
PostgreSQL-specific schema description keys.
Definition: PgsqlSqlUtil.qm.dox.h:660
private bool supportsTypesImpl()
returns True if the database supports named types
softlist getRenameSql(string table_name, string new_name)
returns a string that can be used to rename the trigger in the database
ListIterator typeIterator()
returns an iterator listing the string type names in the database
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 getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
private bool equalImpl(AbstractColumn c)
returns True if the argument is equal to the current object, False if not
private bool equalImpl(AbstractIndex ix)
returns True if the argument is equal to the current index, False if not
softlist getRenameSql(string new_name)
returns a string that can be used to rename the view in the database
private list listTablesImpl()
returns a list of string table names in the database
string string(softstring str, *string enc)
const PgsqlUopMap
a hash of default update operator definitions for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:994
*string tablespace
tablespace name for the table, if known
Definition: PgsqlSqlUtil.qm.dox.h:1014
list listMaterializedViews()
returns a list of string materialized view names in the database
private softint getNextSequenceValueImpl(string name)
returns the next value in the given sequence
represents a PostgreSQL-specific foreign constraint
Definition: PgsqlSqlUtil.qm.dox.h:287
string getCreateSql(string table_name, *hash opt)
returns a string that can be used to create the constraint in the database
list getAddColumnSql(AbstractTable t)
returns a list of sql strings that can be used to add the column to an existing table ...
*string getTablespace()
returns the tablespace name used for this constraint, if known
constructor(string n_name, string n_src, *string n_schemaname, *string n_viewowner)
creates the object from the arguments
constructor(string n, string nt, *string qt, int sz, bool nul, *string dv, *string cm, softint bs, softint n_scale)
creates the column from the supplied arguments
string getDropSql()
returns a string that can be used to drop the function from the database
string getDropSql(*hash opt)
returns a string that can be used to drop a type
constructor(string n, hash n_cols, bool e=True, *string ts)
creates the object with the given attributes
private string getCreateTableSqlImpl(*hash opt)
returns a string that can be used to create the table in the database
constructor(string n, string n_src)
creates the object and sets its name and the trigger source
constructor(string n_name, bool n_unique, hash n_cols, *string n_tablespace)
creates the object from the arguments
string schema
schema name for the table
Definition: PgsqlSqlUtil.qm.dox.h:1017
string getCreateSql(string table_name, *hash opts)
returns a string that can be used to create the constraint
const PgsqlCopMap
column operator specializations for PostgreSQL
Definition: PgsqlSqlUtil.qm.dox.h:916
constructor(string n, Columns c, ForeignConstraintTarget t)
creates the constraint from the supplied arguments
list getModifySqlImpl(AbstractTable t, AbstractColumn col, *hash opt)
returns a list of sql strings that can be used to modify the column to the new definition; if the col...
*string tablespace
any tablespace for the unique key index
Definition: PgsqlSqlUtil.qm.dox.h:409
private bool rebuildIndexImpl(string name, *hash options)
rebuild index implementation. See SqlUtil::AbstractDatabase::rebuildIndex()
class for PostgreSQL sequences
Definition: PgsqlSqlUtil.qm.dox.h:540
abstract AbstractIterator keyIterator()
returns an iterator for keys iterating a list of string key names
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
private hash getSchemaDescriptionOptions()
returns driver-specific options to the base abstract class
softlist getRenameSql(string new_name)
returns a string that can be used to rename the function in the database
private reclaimSpaceImpl(*hash options)
reclaim space implementation. See SqlUtil::AbstractDatabase::reclaimSpace()
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
private copyImpl(AbstractTable old)
db-specific copy actions
bool equal(PgsqlType type)
returns True if the types are equal
private hash getReclaimSpaceOptions()
returns driver-specific options to the base abstract class
const ReclaimSpaceOptions
clearIndex()
clears any index base for the constraint
string getNativeTypeString()
returns a string giving the native type of the column
private list listFunctionsImpl()
returns a list of string function names in the database