- All Superinterfaces:
Collection<Attribute>
,Iterable<Attribute>
,List<Attribute>
,SequencedCollection<Attribute>
,TargetList
,TargetList.Projection
- All Known Subinterfaces:
TupleDescriptor.Ephemeral
,TupleDescriptor.Interned
TupleDescriptor
is a list of Attribute
, with
a RegType
that identifies its corresponding row type.
The row type might be just RECORD
, though, representing a
transient, unregistered type.
The Attribute
instances may then correspond to nothing that exists in
pg_attribute
, in which case they will be 'virtual' instances whose
CatalogObject.Addressed
methods don't work, but which simply hold a
reference to the TupleDescriptor
they came from instead.
A TupleDescriptor
may also contain attribute defaults and/or
constraints. These would be less often of interest in Java; if there is
a need to make them available, rather than complicating
TupleDescriptor
, it will probably be more natural to make them
available by methods on Attribute
.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A descriptor that has been constructed on the fly and has not been interned.static interface
A descriptor that either describes a known composite type in the catalogs, or has been interned in PostgreSQL's type cache, and has a distinctrowType
that can be used to identify it for the duration of the session.Nested classes/interfaces inherited from interface org.postgresql.pljava.TargetList
TargetList.Cursor, TargetList.Projection
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.default Attribute
Deprecated, for removal: This API element is subject to removal in a future version.A one-by-one lookup-by-name API forces the implementation to cater to an inefficient usage pattern, when callers will often have a number of named attributes to look up, which can be done more efficiently in one go; see the methods ofProjection
.default Attribute
Deprecated, for removal: This API element is subject to removal in a future version.A one-by-one lookup-by-name API forces the implementation to cater to an inefficient usage pattern, when callers will often have a number of named attributes to look up, which can be done more efficiently in one go; see the methods ofProjection
.intern()
Return this descriptor unchanged if it is already interned in PostgreSQL's type cache, otherwise an equivalent new descriptor with a differentrowType
uniquely assigned to identify it for the duration of the session.rowType()
If this tuple descriptor is not ephemeral, returns the PostgreSQL type that identifies it.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, toArray, toArray
Methods inherited from interface org.postgresql.pljava.TargetList
applyOver, applyOver, sqlGet
Methods inherited from interface org.postgresql.pljava.TargetList.Projection
project, project, project, project, sqlProject, subList
-
Method Details
-
attributes
Deprecated, for removal: This API element is subject to removal in a future version.As a subinterface ofProjection
, aTupleDescriptor
already is aList<Attribute>
, and there is no need for this method to simply return its own receiver. -
rowType
RegType rowType()If this tuple descriptor is not ephemeral, returns the PostgreSQL type that identifies it.If the descriptor is for a known composite type in the PostgreSQL catalog, this method returns that type.
If the descriptor has been created programmatically and interned, this method returns the type
RECORD
.modifier(n)
where n was uniquely assigned by PostgreSQL when the descriptor was interned, and will reliably refer to this tuple descriptor for the duration of the session.For any ephemeral descriptor passed around in code without being interned, this method returns plain
RECORD
, which is useless for identifying the tuple structure. -
get
@Deprecated(forRemoval=true) default Attribute get(Lexicals.Identifier.Simple name) throws SQLException Deprecated, for removal: This API element is subject to removal in a future version.A one-by-one lookup-by-name API forces the implementation to cater to an inefficient usage pattern, when callers will often have a number of named attributes to look up, which can be done more efficiently in one go; see the methods ofProjection
.Gets an attribute by name.This API should be considered scaffolding or preliminary, until an API can be designed that might offer a convenient usage idiom without presupposing something like a name-to-attribute map in every decriptor.
This default implementation simply does
project(name).get(0)
. Code that will do so repeatedly might be improved by doing so once and retaining the result.- Throws:
SQLSyntaxErrorException
- 42703 if no attribute name matchesSQLException
-
get
Deprecated, for removal: This API element is subject to removal in a future version.A one-by-one lookup-by-name API forces the implementation to cater to an inefficient usage pattern, when callers will often have a number of named attributes to look up, which can be done more efficiently in one go; see the methods ofProjection
.Equivalent toget(Simple.fromJava(name))
.This API should be considered scaffolding or preliminary, until an API can be designed that might offer a convenient usage idiom without presupposing something like a name-to-attribute map in every descriptor.
- Throws:
SQLSyntaxErrorException
- 42703 if no attribute name matchesSQLException
-
intern
TupleDescriptor.Interned intern()Return this descriptor unchanged if it is already interned in PostgreSQL's type cache, otherwise an equivalent new descriptor with a differentrowType
uniquely assigned to identify it for the duration of the session.PostgreSQL calls this operation "BlessTupleDesc", which updates the descriptor in place; in PL/Java code, the descriptor returned by this method should be used in place of the original.
-
Projection
, aTupleDescriptor
already is aList<Attribute>
, and there is no need for this method to simply return its own receiver.