- All Superinterfaces:
CatalogObject
,CatalogObject.AccessControlled<org.postgresql.pljava.model.CatalogObject.USAGE>
,CatalogObject.Addressed<RegType>
,CatalogObject.Named<Lexicals.Identifier.Simple>
,CatalogObject.Namespaced<Lexicals.Identifier.Simple>
,CatalogObject.Owned
,SQLType
- All Known Subinterfaces:
RegType.Unresolved
This class also has static final fields for a selection of commonly used
RegType
s, such as those that correspond to types mentioned in JDBC,
and others that are just ubiquitous when working in PostgreSQL in general,
or are used in this model package.
An instance of RegType
also implements the JDBC
SQLType
interface, with the intention that it could be used
with a suitably-aware JDBC implementation to identify any type available
in PostgreSQL.
A type can have a 'modifier' (think NUMERIC(4)
versus plain
NUMERIC
). In PostgreSQL's C code, a type oid and modifier have to
be passed around in tandem. Here, you apply
modifier(int)
to the unmodified RegType
and
obtain a distinct RegType
instance incorporating the modifier.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
static interface
static interface
static interface
static interface
static interface
static interface
static interface
static interface
static interface
Interface additionally implemented by an instance that represents a type (such as the PostgreSQL polymorphic pseudotypes or the even wilder "any" type) needing resolution to an actual type used at a given call site.Nested classes/interfaces inherited from interface org.postgresql.pljava.model.CatalogObject
CatalogObject.AccessControlled<T extends CatalogObject.Grant>, CatalogObject.Addressed<T extends CatalogObject.Addressed<T>>, CatalogObject.Component, CatalogObject.Grant, CatalogObject.Named<T extends Lexicals.Identifier.Unqualified<T>>, CatalogObject.Namespaced<T extends Lexicals.Identifier.Unqualified<T>>, CatalogObject.Owned
-
Field Summary
Modifier and TypeFieldDescriptionstatic final RegType
static final RegType
static final RegType
static final RegType
"Blank-padded CHAR", the PostgreSQL type that corresponds to the SQL standardCHAR
(spelled without quotes) type.static final RegType
static final RegType
The PostgreSQL type"char"
(the quotes are needed to distinguish it from the different SQL type namedCHAR
), which is an eight-bit signed value with no associated character encoding (though it is often used in the catalogs with ASCII-letter values as an ersatz enum).static final RegClass.Known
<RegType> static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
static final RegType
Fields inherited from interface org.postgresql.pljava.model.CatalogObject
InvalidOid
-
Method Summary
Modifier and TypeMethodDescriptionanalyze()
array()
baseType()
boolean
byValue()
char
category()
A one-character code representing the type's 'category'.boolean
defined()
byte
int
element()
default String
getName()
The name of this type as aString
, as the JDBCSQLType
interface requires.default String
A string identifying the "vendor" for which the type name and number here are meaningful, as the JDBCSQLType
interface requires.default Integer
A vendor-specific type number identifying this type, as the JDBCSQLType
interface requires.input()
short
length()
int
modifier()
Returns the modifier if this instance has one, else -1.modifier
(int typmod) default boolean
Whether this instance represents a type (such as the PostgreSQL polymorphic pseudotypes or the even wilder "any" type) needing resolution to an actual type used at a given call site.boolean
notNull()
output()
boolean
receive()
relation()
send()
storage()
The correspondingTupleDescriptor
, non-null only for composite types.type()
Returns theRegType
for this type with no modifier, if this instance has one.Methods inherited from interface org.postgresql.pljava.model.CatalogObject
isValid, of, oid
Methods inherited from interface org.postgresql.pljava.model.CatalogObject.AccessControlled
grants, grants
Methods inherited from interface org.postgresql.pljava.model.CatalogObject.Addressed
classId, exists, shared
Methods inherited from interface org.postgresql.pljava.model.CatalogObject.Named
name
Methods inherited from interface org.postgresql.pljava.model.CatalogObject.Namespaced
namespace, namespaceName, qualifiedName
Methods inherited from interface org.postgresql.pljava.model.CatalogObject.Owned
owner
-
Field Details
-
CLASSID
-
BOOL
-
BYTEA
-
CHAR
The PostgreSQL type"char"
(the quotes are needed to distinguish it from the different SQL type namedCHAR
), which is an eight-bit signed value with no associated character encoding (though it is often used in the catalogs with ASCII-letter values as an ersatz enum).It can be mapped to the JDBC type
TINYINT
, or Javabyte
. -
INT8
-
INT2
-
INT4
-
XML
-
FLOAT4
-
FLOAT8
-
BPCHAR
"Blank-padded CHAR", the PostgreSQL type that corresponds to the SQL standardCHAR
(spelled without quotes) type. -
VARCHAR
-
DATE
-
TIME
-
TIMESTAMP
-
TIMESTAMPTZ
-
TIMETZ
-
BIT
-
VARBIT
-
NUMERIC
-
TEXT
-
UNKNOWN
-
RECORD
-
CSTRING
-
VOID
-
TRIGGER
-
NAME
-
REGPROC
-
OID
-
PG_NODE_TREE
-
ACLITEM
-
REGPROCEDURE
-
REGOPER
-
REGOPERATOR
-
REGCLASS
-
REGTYPE
-
REGCONFIG
-
REGDICTIONARY
-
REGNAMESPACE
-
REGROLE
-
REGCOLLATION
-
-
Method Details
-
needsResolution
default boolean needsResolution()Whether this instance represents a type (such as the PostgreSQL polymorphic pseudotypes or the even wilder "any" type) needing resolution to an actual type used at a given call site.This information does not come from the
pg_type
catalog, but simply reflects PostgreSQL-version-specific knowledge of which types require such treatment.This default implementation returns false.
- See Also:
-
length
short length() -
byValue
boolean byValue() -
type
RegType.Type type() -
category
char category()A one-character code representing the type's 'category'.Custom categories are possible, so not every value here need correspond to a
PredefinedCategory
, but common ones will, and can be 'decoded' withBaseUDT.PredefinedCategory.valueOf(char)
. -
preferred
boolean preferred() -
defined
boolean defined() -
delimiter
byte delimiter() -
relation
RegClass relation() -
element
RegType element() -
array
RegType array() -
input
RegProcedure<RegType.TypeInput> input() -
output
RegProcedure<RegType.TypeOutput> output() -
receive
RegProcedure<RegType.TypeReceive> receive() -
send
RegProcedure<RegType.TypeSend> send() -
modifierInput
RegProcedure<RegType.TypeModifierInput> modifierInput() -
modifierOutput
RegProcedure<RegType.TypeModifierOutput> modifierOutput() -
analyze
RegProcedure<RegType.TypeAnalyze> analyze() -
subscript
RegProcedure<RegType.TypeSubscript> subscript() -
alignment
BaseUDT.Alignment alignment() -
storage
BaseUDT.Storage storage() -
notNull
boolean notNull() -
baseType
RegType baseType() -
dimensions
int dimensions() -
collation
RegCollation collation() -
defaultBin
SQLXML defaultBin() -
defaultText
String defaultText() -
modifier
-
withoutModifier
RegType withoutModifier()Returns theRegType
for this type with no modifier, if this instance has one.If not, simply returns
this
. -
modifier
int modifier()Returns the modifier if this instance has one, else -1. -
tupleDescriptor
TupleDescriptor.Interned tupleDescriptor()The correspondingTupleDescriptor
, non-null only for composite types. -
getName
The name of this type as aString
, as the JDBCSQLType
interface requires.The string produced here is as would be produced by
deparse(StandardCharsets.UTF_8)
applied to the result ofqualifiedName()
. The returned string may include double-quote marks, which affect its case sensitivity and the characters permitted within it. If an application is not required to use this method for JDBC compatibility, it can avoid needing to fuss with those details by usingqualifiedName
instead. -
getVendor
A string identifying the "vendor" for which the type name and number here are meaningful, as the JDBCSQLType
interface requires.The JDBC API provides that the result "typically is the package name for this vendor", and this method returns
org.postgresql
as a constant string.Note, however, that every type that is defined in the current PostgreSQL database can be represented by an instance of this interface, whether built in to PostgreSQL, installed with an extension, or user-defined. Therefore, not every instance with this "vendor" string can be assumed to be a type known to all PostgreSQL databases. Moreover, even if the same extension-provided or user-defined type is present in different PostgreSQL databases, it need not be installed with the same
qualifiedName
in each, and will almost certainly have different object IDs, sogetName
andgetVendorTypeNumber
may not in general identify the same type across unrelated PostgreSQL databases. -
getVendorTypeNumber
A vendor-specific type number identifying this type, as the JDBCSQLType
interface requires.This implementation returns the
oid
of the type in the current database. However, except for the subset of types that are built in to PostgreSQL with oid values that are fixed, the result of this method should only be relied on to identify a type within the current database.- Specified by:
getVendorTypeNumber
in interfaceSQLType
-