Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
44430dbc
Commit
44430dbc
authored
21 years ago
by
Peter Eisentraut
Browse files
Options
Downloads
Patches
Plain Diff
Fix bugs in referential_constraints view.
parent
4a48c671
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/information_schema.sgml
+3
-3
3 additions, 3 deletions
doc/src/sgml/information_schema.sgml
src/backend/catalog/information_schema.sql
+28
-16
28 additions, 16 deletions
src/backend/catalog/information_schema.sql
with
31 additions
and
19 deletions
doc/src/sgml/information_schema.sgml
+
3
−
3
View file @
44430dbc
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/information_schema.sgml,v 1.
9
2003/
09/20 20:12:05 tgl
Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/information_schema.sgml,v 1.
10
2003/
10/16 23:46:17 petere
Exp $ -->
<chapter id="information-schema">
<title>The Information Schema</title>
...
...
@@ -2146,7 +2146,7 @@ ORDER BY c.ordinal_position;
<entry>
Update rule of the foreign key constraint:
<literal>CASCADE</literal>, <literal>SET NULL</literal>,
<literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,or
<literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,
or
<literal>NO ACTION</literal>.
</entry>
</row>
...
...
@@ -2157,7 +2157,7 @@ ORDER BY c.ordinal_position;
<entry>
Delete rule of the foreign key constraint:
<literal>CASCADE</literal>, <literal>SET NULL</literal>,
<literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,or
<literal>SET DEFAULT</literal>, <literal>RESTRICT</literal>,
or
<literal>NO ACTION</literal>.
</entry>
</row>
...
...
This diff is collapsed.
Click to expand it.
src/backend/catalog/information_schema.sql
+
28
−
16
View file @
44430dbc
...
...
@@ -4,7 +4,7 @@
*
* Copyright 2003, PostgreSQL Global Development Group
*
* $Id: information_schema.sql,v 1.1
2
2003/
06/29 15:14:41
petere Exp $
* $Id: information_schema.sql,v 1.1
3
2003/
10/16 23:46:17
petere Exp $
*/
/*
...
...
@@ -747,11 +747,26 @@ GRANT SELECT ON parameters TO PUBLIC;
* REFERENTIAL_CONSTRAINTS view
*/
CREATE
FUNCTION
_pg_keyissubset
(
smallint
[],
smallint
[])
RETURNS
boolean
LANGUAGE
sql
IMMUTABLE
RETURNS
NULL
ON
NULL
INPUT
AS
'select $1[1] is null or ($1[1] = any ($2) and coalesce(_pg_keyissubset($1[2:array_upper($1,1)], $2), true))'
;
CREATE
FUNCTION
_pg_keysequal
(
smallint
[],
smallint
[])
RETURNS
boolean
LANGUAGE
sql
IMMUTABLE
RETURNS
NULL
ON
NULL
INPUT
AS
'select _pg_keyissubset($1, $2) and _pg_keyissubset($2, $1)'
;
CREATE
VIEW
referential_constraints
AS
SELECT
CAST
(
current_database
()
AS
sql_identifier
)
AS
constraint_catalog
,
CAST
(
ncon
.
nspname
AS
sql_identifier
)
AS
constraint_schema
,
CAST
(
con
.
conname
AS
sql_identifier
)
AS
constraint_name
,
CAST
(
current_database
()
AS
sql_identifier
)
AS
unique_constraint_catalog
,
CAST
(
CASE
WHEN
npkc
.
nspname
IS
NULL
THEN
NULL
ELSE
current_database
()
END
AS
sql_identifier
)
AS
unique_constraint_catalog
,
CAST
(
npkc
.
nspname
AS
sql_identifier
)
AS
unique_constraint_schema
,
CAST
(
pkc
.
conname
AS
sql_identifier
)
AS
unique_constraint_name
,
...
...
@@ -766,7 +781,7 @@ CREATE VIEW referential_constraints AS
WHEN
'n'
THEN
'SET NULL'
WHEN
'd'
THEN
'SET DEFAULT'
WHEN
'r'
THEN
'RESTRICT'
WHEN
'a'
THEN
'NOACTION'
END
WHEN
'a'
THEN
'NO
ACTION'
END
AS
character_data
)
AS
update_rule
,
CAST
(
...
...
@@ -774,22 +789,19 @@ CREATE VIEW referential_constraints AS
WHEN
'n'
THEN
'SET NULL'
WHEN
'd'
THEN
'SET DEFAULT'
WHEN
'r'
THEN
'RESTRICT'
WHEN
'a'
THEN
'NOACTION'
END
WHEN
'a'
THEN
'NO
ACTION'
END
AS
character_data
)
AS
delete_rule
FROM
pg_namespace
ncon
,
pg_constraint
con
,
pg_class
c
,
pg_constraint
pkc
,
pg_namespace
npkc
,
pg_user
u
FROM
(
pg_namespace
ncon
INNER
JOIN
pg_constraint
con
ON
ncon
.
oid
=
con
.
connamespace
INNER
JOIN
pg_class
c
ON
con
.
conrelid
=
c
.
oid
INNER
JOIN
pg_user
u
ON
c
.
relowner
=
u
.
usesysid
)
LEFT
JOIN
(
pg_constraint
pkc
INNER
JOIN
pg_namespace
npkc
ON
pkc
.
connamespace
=
npkc
.
oid
)
ON
con
.
confrelid
=
pkc
.
conrelid
AND
_pg_keysequal
(
con
.
confkey
,
pkc
.
conkey
)
WHERE
ncon
.
oid
=
con
.
connamespace
AND
con
.
conrelid
=
c
.
oid
AND
con
.
confkey
=
pkc
.
conkey
AND
pkc
.
connamespace
=
npkc
.
oid
AND
c
.
relowner
=
u
.
usesysid
AND
c
.
relkind
=
'r'
WHERE
c
.
relkind
=
'r'
AND
con
.
contype
=
'f'
AND
(
pkc
.
contype
IN
(
'p'
,
'u'
)
OR
pkc
.
contype
IS
NULL
)
AND
u
.
usename
=
current_user
;
GRANT
SELECT
ON
referential_constraints
TO
PUBLIC
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment