Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e9c013f4
Commit
e9c013f4
authored
Jul 22, 2002
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unique index on pg_cast.oid, and document pg_cast table.
parent
a7ffd69d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
15 deletions
+86
-15
doc/src/sgml/catalogs.sgml
doc/src/sgml/catalogs.sgml
+65
-1
src/backend/catalog/indexing.c
src/backend/catalog/indexing.c
+2
-2
src/backend/commands/functioncmds.c
src/backend/commands/functioncmds.c
+15
-10
src/include/catalog/indexing.h
src/include/catalog/indexing.h
+4
-2
No files found.
doc/src/sgml/catalogs.sgml
View file @
e9c013f4
<!--
Documentation of the system catalogs, directed toward PostgreSQL developers
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.4
5 2002/07/12 18:43:12 tgl
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.4
6 2002/07/22 20:23:19 petere
Exp $
-->
<chapter id="catalogs">
...
...
@@ -66,6 +66,11 @@
<entry>table columns (<quote>attributes</quote>, <quote>fields</quote>)</entry>
</row>
<row>
<entry>pg_cast</entry>
<entry>casts (data type conversions)</entry>
</row>
<row>
<entry>pg_class</entry>
<entry>tables, indexes, sequences (<quote>relations</quote>)</entry>
...
...
@@ -519,6 +524,65 @@
</sect1>
<sect1 id="catalog-pg-cast">
<title>pg_cast</title>
<para>
<structname>pg_cast</structname> stores data type conversion paths
defined with <command>CREATE CAST</command> plus the built-in
conversions.
</para>
<table>
<title>pg_cast Columns</title>
<tgroup cols=4>
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>References</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>castsource</entry>
<entry><type>oid</type></entry>
<entry>pg_type.oid</entry>
<entry>OID of the source data type</entry>
</row>
<row>
<entry>casttarget</entry>
<entry><type>oid</type></entry>
<entry>pg_type.oid</entry>
<entry>OID of the target data type</entry>
</row>
<row>
<entry>castfunc</entry>
<entry><type>oid</type></entry>
<entry>pg_proc.oid</entry>
<entry>
The OID of the function to use to perform this cast. A 0 is
stored if the data types are binary compatible (that is, no
function is needed to perform the cast).
</entry>
</row>
<row>
<entry>castimplicit</entry>
<entry><type>bool</type></entry>
<entry></entry>
<entry>Indication whether this cast can be invoked implicitly</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id="catalog-pg-class">
<title>pg_class</title>
...
...
src/backend/catalog/indexing.c
View file @
e9c013f4
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.9
8 2002/07/18 23:11:27
petere Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.9
9 2002/07/22 20:23:19
petere Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -44,7 +44,7 @@ char *Name_pg_attr_indices[Num_pg_attr_indices] =
char
*
Name_pg_attrdef_indices
[
Num_pg_attrdef_indices
]
=
{
AttrDefaultIndex
,
AttrDefaultOidIndex
};
char
*
Name_pg_cast_indices
[
Num_pg_cast_indices
]
=
{
CastSourceTargetIndex
};
{
Cast
OidIndex
,
Cast
SourceTargetIndex
};
char
*
Name_pg_class_indices
[
Num_pg_class_indices
]
=
{
ClassNameNspIndex
,
ClassOidIndex
};
char
*
Name_pg_constraint_indices
[
Num_pg_constraint_indices
]
=
...
...
src/backend/commands/functioncmds.c
View file @
e9c013f4
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.1
1 2002/07/20 05:37:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.1
2 2002/07/22 20:23:19 petere
Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
...
...
@@ -31,6 +31,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "catalog/catname.h"
#include "catalog/dependency.h"
...
...
@@ -693,7 +694,7 @@ CreateCast(CreateCastStmt *stmt)
if
(
procstruct
->
proisagg
)
elog
(
ERROR
,
"cast function must not be an aggregate function"
);
if
(
procstruct
->
proretset
)
elog
(
ERROR
,
"cast function must
be
not return a set"
);
elog
(
ERROR
,
"cast function must not return a set"
);
ReleaseSysCache
(
tuple
);
}
...
...
@@ -727,7 +728,7 @@ CreateCast(CreateCastStmt *stmt)
CatalogCloseIndices
(
Num_pg_cast_indices
,
idescs
);
}
myself
.
classId
=
get_system_catalog_relid
(
CastRelationName
);
myself
.
classId
=
RelationGetRelid
(
relation
);
myself
.
objectId
=
HeapTupleGetOid
(
tuple
);
myself
.
objectSubId
=
0
;
...
...
@@ -819,21 +820,25 @@ DropCast(DropCastStmt *stmt)
void
DropCastById
(
Oid
castOid
)
{
Relation
relation
;
Relation
relation
,
index
;
ScanKeyData
scankey
;
Heap
ScanDesc
scan
;
Index
ScanDesc
scan
;
HeapTuple
tuple
;
relation
=
heap_openr
(
CastRelationName
,
RowExclusiveLock
);
index
=
index_openr
(
CastOidIndex
);
ScanKeyEntryInitialize
(
&
scankey
,
0x0
,
ObjectIdAttributeNumber
,
F_OIDEQ
,
ObjectIdGetDatum
(
castOid
));
scan
=
heap_beginscan
(
relation
,
SnapshotNow
,
1
,
&
scankey
);
tuple
=
heap_getnext
(
scan
,
ForwardScanDirection
);
1
,
F_OIDEQ
,
ObjectIdGetDatum
(
castOid
));
scan
=
index_beginscan
(
relation
,
index
,
SnapshotNow
,
1
,
&
scankey
);
tuple
=
index_getnext
(
scan
,
ForwardScanDirection
);
if
(
HeapTupleIsValid
(
tuple
))
simple_heap_delete
(
relation
,
&
tuple
->
t_self
);
else
elog
(
ERROR
,
"could not find tuple for cast %u"
,
castOid
);
heap_endscan
(
scan
);
index_endscan
(
scan
);
index_close
(
index
);
heap_close
(
relation
,
RowExclusiveLock
);
}
src/include/catalog/indexing.h
View file @
e9c013f4
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: indexing.h,v 1.7
1 2002/07/18 23:11:30
petere Exp $
* $Id: indexing.h,v 1.7
2 2002/07/22 20:23:19
petere Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -26,7 +26,7 @@
#define Num_pg_amproc_indices 1
#define Num_pg_attr_indices 2
#define Num_pg_attrdef_indices 2
#define Num_pg_cast_indices
1
#define Num_pg_cast_indices
2
#define Num_pg_class_indices 2
#define Num_pg_constraint_indices 3
#define Num_pg_conversion_indices 3
...
...
@@ -61,6 +61,7 @@
#define AttrDefaultOidIndex "pg_attrdef_oid_index"
#define AttributeRelidNameIndex "pg_attribute_relid_attnam_index"
#define AttributeRelidNumIndex "pg_attribute_relid_attnum_index"
#define CastOidIndex "pg_cast_oid_index"
#define CastSourceTargetIndex "pg_cast_source_target_index"
#define ClassNameNspIndex "pg_class_relname_nsp_index"
#define ClassOidIndex "pg_class_oid_index"
...
...
@@ -169,6 +170,7 @@ DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index on pg_attrdef using btree(ad
DECLARE_UNIQUE_INDEX
(
pg_attrdef_oid_index
on
pg_attrdef
using
btree
(
oid
oid_ops
));
DECLARE_UNIQUE_INDEX
(
pg_attribute_relid_attnam_index
on
pg_attribute
using
btree
(
attrelid
oid_ops
,
attname
name_ops
));
DECLARE_UNIQUE_INDEX
(
pg_attribute_relid_attnum_index
on
pg_attribute
using
btree
(
attrelid
oid_ops
,
attnum
int2_ops
));
DECLARE_UNIQUE_INDEX
(
pg_cast_oid_index
on
pg_cast
using
btree
(
oid
oid_ops
));
DECLARE_UNIQUE_INDEX
(
pg_cast_source_target_index
on
pg_cast
using
btree
(
castsource
oid_ops
,
casttarget
oid_ops
));
DECLARE_UNIQUE_INDEX
(
pg_class_oid_index
on
pg_class
using
btree
(
oid
oid_ops
));
DECLARE_UNIQUE_INDEX
(
pg_class_relname_nsp_index
on
pg_class
using
btree
(
relname
name_ops
,
relnamespace
oid_ops
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment