|
2 | 2 | * ruleutils.c- Functions to convert stored expressions/querytrees
|
3 | 3 | *back to source text
|
4 | 4 | *
|
5 |
| - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.234 2006/10/04 00:29:59 momjian Exp $ |
| 5 | + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.235 2006/11/10 22:59:29 tgl Exp $ |
6 | 6 | **********************************************************************/
|
7 | 7 |
|
8 | 8 | #include"postgres.h"
|
@@ -1288,12 +1288,14 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS)
|
1288 | 1288 | Form_pg_dependdeprec= (Form_pg_depend)GETSTRUCT(tup);
|
1289 | 1289 |
|
1290 | 1290 | /*
|
1291 |
| - * We assume any auto dependency of a relation on a column must be |
1292 |
| - * what we are looking for. |
| 1291 | + * We assume any auto dependency of a sequence on a column must be |
| 1292 | + * what we are looking for. (We need the relkind test because indexes |
| 1293 | + * can also have auto dependencies on columns.) |
1293 | 1294 | */
|
1294 | 1295 | if (deprec->classid==RelationRelationId&&
|
1295 | 1296 | deprec->objsubid==0&&
|
1296 |
| -deprec->deptype==DEPENDENCY_AUTO) |
| 1297 | +deprec->deptype==DEPENDENCY_AUTO&& |
| 1298 | +get_rel_relkind(deprec->objid)==RELKIND_SEQUENCE) |
1297 | 1299 | {
|
1298 | 1300 | sequenceId=deprec->objid;
|
1299 | 1301 | break;
|
|