|
3 | 3 | *back to source text
|
4 | 4 | *
|
5 | 5 | * IDENTIFICATION
|
6 |
| - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.196 2005/05/27 00:57:49 neilc Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.197 2005/05/30 01:57:27 tgl Exp $ |
7 | 7 | *
|
8 | 8 | * This software is copyrighted by Jan Wieck - Hamburg.
|
9 | 9 | *
|
@@ -1919,6 +1919,28 @@ get_select_query_def(Query *query, deparse_context *context,
|
1919 | 1919 | else
|
1920 | 1920 | get_rule_expr(query->limitCount,context, false);
|
1921 | 1921 | }
|
| 1922 | + |
| 1923 | +/* Add the FOR UPDATE/SHARE clause if present */ |
| 1924 | +if (query->rowMarks!=NIL) |
| 1925 | +{ |
| 1926 | +if (query->forUpdate) |
| 1927 | +appendContextKeyword(context," FOR UPDATE OF ", |
| 1928 | +-PRETTYINDENT_STD,PRETTYINDENT_STD,0); |
| 1929 | +else |
| 1930 | +appendContextKeyword(context," FOR SHARE OF ", |
| 1931 | +-PRETTYINDENT_STD,PRETTYINDENT_STD,0); |
| 1932 | +sep=""; |
| 1933 | +foreach(l,query->rowMarks) |
| 1934 | +{ |
| 1935 | +intrtindex=lfirst_int(l); |
| 1936 | +RangeTblEntry*rte=rt_fetch(rtindex,query->rtable); |
| 1937 | + |
| 1938 | +appendStringInfo(buf,"%s%s", |
| 1939 | +sep, |
| 1940 | +quote_identifier(rte->eref->aliasname)); |
| 1941 | +sep=", "; |
| 1942 | +} |
| 1943 | +} |
1922 | 1944 | }
|
1923 | 1945 |
|
1924 | 1946 | staticvoid
|
|