{"id":288830,"date":"2018-09-01T05:55:02","date_gmt":"2018-09-01T01:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288830"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288830","title":{"rendered":"\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u041e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419749\/\" class=\"post__text post__text-html js-mediator-article\">\u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c\u0438: pg_class, pg_attribute, pg_constraints \u0438 \u0442.\u0434. <a href=\"https:\/\/habr.com\/post\/415575\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a>, <a href=\"https:\/\/habr.com\/post\/415897\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/post\/418597\/\">\u0442\u0440\u0435\u0442\u044c\u044f<\/a> \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b \u0440\u0430\u043d\u0435\u0435.  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zc\/rx\/ta\/zcrxta08dnfat5cqpgid4lyq7by.png\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c\u0438 \u0438\u0437 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 PostgrSQL, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c, \u0434\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0442\u0435\u0445, \u0447\u0442\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445. \u0422\u0430\u043a\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u044f\u043c\u043e \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  <a name=\"habracut\"><\/a>   <\/p>\n<p>\u0412\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435, \u0441\u043e\u043e\u0431\u0449\u0430\u044e, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 <b>\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445<\/b> \u0438 <b>\u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439<\/b>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446. \u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Table_ComplexFeatures<\/b>, <a href=\"https:\/\/habr.com\/post\/415575\/#ExpFeatures\"> \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a \u0446\u0435\u043b\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439- \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0422\u0435\u043c \u0438\u0437 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a <a href=\"#Script2\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e<\/a>. <br \/>  <a name=\"tfPKCF_def\"><\/a>  <\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mz\/oy\/gj\/mzoygj-qqx8sqyug_-hesgcypsu.png\"><br \/>  <i>\u0420\u0438\u0441. 4. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 admtf_PrimaryKey_ComplexFeatures.<\/i><br \/>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 20. \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/4s\/si\/fi\/4ssifibkguxld-bpg7ovcac-yua.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u2116<\/th>\n<th width=\"10\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"40\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">1<\/td>\n<td width=\"10\"><a href=\"#tfPKCF\">admtf_PrimaryKey_Features<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (PRIMARY KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\"><a href=\"#tfPKCF\">admtf_PrimaryKey_Attributes<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (PRIMARY KEY) \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">3<\/td>\n<td width=\"10\"><a href=\"#tfPKCF\">admtf_PrimaryKey_ComplexFeatures<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (PRIMARY KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043a\u043b\u044e\u0447 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432.<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_PrimaryKey_ComplexFeatures \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 21. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_PrimaryKey_ComplexFeatures (&#8216;public&#8217;,&#8217; xpkstreet&#8217;).<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2m\/jm\/or\/2mjmorpx-mzqp2qh__mc9qtnw0u.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f<\/th>\n<th width=\"5\">\u2116<\/th>\n<th width=\"15\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"20\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"20\"> \u0442\u0438\u043f<\/th>\n<th width=\"20\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f<\/th>\n<th width=\"5\">? not NULL<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">pkl<\/td>\n<td width=\"5\">0<\/td>\n<td width=\"15\">xpkstreet<\/td>\n<td width=\"20\">\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b street<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">pkatt<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">pkatt<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">localityid<\/td>\n<td width=\"20\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">localityid<\/td>\n<td width=\"20\">integer<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">pkatt<\/td>\n<td width=\"5\">3<\/td>\n<td width=\"15\">streetid<\/td>\n<td width=\"20\">\u0418\u0414 \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">streetid<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (<b>a_PrimaryKeyName<\/b>) \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (<b>a_SchemaName<\/b>). \u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. <\/p>\n<p>  <\/p>\n<p><a href=\"#tfPKCF\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>  <a name=\"tfPKF_def\"><\/a>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_PrimaryKey_Features<\/b>) \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 SELECT, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_r\/y2\/fc\/_ry2fce5e7ni0adm4jwaj5_561w.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT con.conname,                COALESCE(dsc.description,'\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b '|| tbl.relname)              FROM pg_constraint con                  INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                  INNER JOIN pg_class tbl ON con.conrelid=tbl.oid                 LEFT OUTER JOIN pg_Description dsc ON con.oid=dsc.objoid                                                 AND dsc.objsubid=0             WHERE con.contype ='p' AND nspc.nspname=LOWER(a_SchemaName)                AND con.conname =LOWER(a_PrimaryKeyName);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfPKA_def\"><\/a>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_PrimaryKey_Attributes<\/b>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ls\/3n\/wi\/ls3nwivnnefslizh2xbtj5azlv0.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT (rank() OVER (PARTITION BY con.conrelid ORDER BY con.No)) ::SMALLINT,       attr.attnum,attr.attname::NAME,       CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::VARCHAR(100) ELSE '' END,       FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                  COALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::VARCHAR(256),        attr.attnotnull     FROM (SELECT c.oid, c.conrelid,c.connamespace,c.confrelid,c.conname, c.contype,                       c.conkey::SMALLINT[],generate_subscripts(c.conkey, 1) as No                   FROM pg_constraint c) con                     INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                      INNER JOIN pg_attribute attr ON attr.attrelid=con.conrelid                             AND attr.attnum=con.conkey[con.No]                      LEFT OUTER JOIN pg_type typ ON attr.atttypid=typ.oid                      LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid     WHERE con.contype ='p' AND nspc.nspname=LOWER(a_SchemaName)                            AND con.conname =LOWER(a_PrimaryKeyName)     ORDER BY con.No; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0431 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. \u041e\u043d\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 (<b>con.No<\/b>), \u0430 \u043d\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (<b>attr.attnum<\/b>).<\/p>\n<p>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415897\/#tfTableC_woc_def\">\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_Constraintes<\/b> \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u00bb<\/a>. <\/p>\n<p>  <a name=\"tfFKCF_def\"><\/a>  <\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ez\/to\/eh\/eztoehtxaxbepcsebh2th1pk8a8.png\"><br \/>  <i>\u0420\u0438\u0441. 5. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 admtf_ForeignKey_ComplexFeatures.<\/i><br \/>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 22. \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sg\/uk\/lx\/sguklx7u5ijwcccv0rnvpemw-k8.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u2116<\/th>\n<th width=\"10\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"40\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">1<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ ForeignKey _Features<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (FOREIGN KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ ForeignKey_Attributes<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">3<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ForeignKey_ReferenceTableFeatures<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">4<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ForeignKey_ReferenceTableAttributes<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">5<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ForeignKey_ReferenceTableComplexFeatures<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439) \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">6<\/td>\n<td width=\"10\"><a href=\"#tfFKCF\">admtf_ForeignKey_ComplexFeatures<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (FOREIGN KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441. <\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_ForeignKey_ComplexFeatures \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_ForeignKey_ComplexFeatures<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  &lt;strong\u0422\u0430\u0431\u043b\u0438\u0446\u0430 23. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_PrimaryKey_ComplexFeatures (&#8216;public&#8217;,&#8217;fk_street_locality&#8217;,3).<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bx\/2y\/4o\/bx2y4o-d1_5or8ckuybb5ubgzn0.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f<\/th>\n<th width=\"5\">\u2116<\/th>\n<th width=\"15\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"20\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"20\"> \u0442\u0438\u043f<\/th>\n<th width=\"20\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f<\/th>\n<th width=\"5\">? not NULL<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">fk03<\/td>\n<td width=\"5\">3<\/td>\n<td width=\"15\">fk_street_locality<\/td>\n<td width=\"20\">\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b street<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk03att<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk03att<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">localityid<\/td>\n<td width=\"20\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">localityid<\/td>\n<td width=\"20\">integer<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk03rtbl<\/td>\n<td width=\"5\">0<\/td>\n<td width=\"15\">locality<\/td>\n<td width=\"20\">\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk03ratt<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk03ratt<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">localityid<\/td>\n<td width=\"20\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">localityid<\/td>\n<td width=\"20\">integer<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (<b>a_ ForeignKey<\/b>) \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 (<b>a_SchemaName<\/b>).<\/p>\n<p>  <\/p>\n<p><a href=\"#tfFKCF\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>  <\/p>\n<p>\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_ForeignKeyNo<\/b>). \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0430\u0432\u043d\u044b\u043c <b>3<\/b>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u00ab<b>fk03<\/b>\u00bb, \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u2014 \u00ab<b>fk03att<\/b>\u00bb, \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u2014 \u00ab<b>fk03rtbl<\/b>\u00bb, \u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0431 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u2014 \u00ab<b>fk03ratt<\/b>\u00bb. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0432 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0431\u044b\u043b\u0438 \u0431\u044b \u00ab<b>fk<\/b>\u00bb, \u00ab<b>fkatt<\/b>\u00bb, \u00ab<b>fkrtbl<\/b>\u00bb \u0438 \u00ab<b>fkratt<\/b>\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041f\u043e \u044d\u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_ForeignKey_ComplexFeatures<\/b>, \u0430 \u043d\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c\u043e\u0442\u0440\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415575\/#ExpFeatures\">\u00ab\u041e \u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u0445 \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c?\u00bb<\/a><\/p>\n<p>.   <\/p>\n<p>\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0442\u0440\u0435\u0445 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  <a name=\"tfFKF_def\"><\/a>   <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_ForeignKey_Features<\/b>) \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 SELECT, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sf\/0h\/7w\/sf0h7wiaijixf7bc9tmgnr3ovww.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT con.conname, COALESCE(dsc.description,'\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b '|| tbl.relname)       FROM pg_constraint con                 INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                 INNER JOIN pg_class tbl ON con.conrelid=tbl.oid                LEFT OUTER JOIN pg_Description dsc ON con.oid=dsc.objoid AND dsc.objsubid=0     WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype='f' \t\t\t\t\tAND con.conname =LOWER(a_ForeignKeyName);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfFKA_def\"><\/a>   <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_ForeignKey_Attributes<\/b>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0431 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430. \u041e\u043d\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435 (<b>con.No<\/b>), \u0430 \u043d\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (<b>attr.attnum<\/b>).<\/p>\n<p>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415897\/#tfTableC_woc_def\">\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_Constraintes<\/b> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u00bb<\/a>.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/dt\/aw\/wx\/dtawwxavur2bvqazvo-cvfvaqrw.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT (rank() OVER (PARTITION BY con.conrelid ORDER BY con.No))::SMALLINT AS r_ForeingKeyNo,                attr.attnum AS r_AttributeNumber,attr.attname::NAME AS r_AttributeName,               CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME ELSE '' END AS r_UserTypeName,               FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid), COALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::NAME AS r_TypeName,               attr.attnotnull AS r_isNotNULL,TRIM(dsc.description) AS r_Description      FROM (SELECT c.oid, c.conrelid,c.confrelid,c.conname,c.connamespace,c.contype,c.conkey::SMALLINT[],c.consrc,                                  c.confkey::SMALLINT[],generate_subscripts(c.conkey, 1) as No FROM pg_constraint c) con                INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                INNER JOIN pg_attribute attr ON attr.attrelid=con.conrelid AND attr.attnum=con.conkey[con.No]                INNER JOIN  pg_type typ ON attr.atttypid=typ.oid                LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid                LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid AND dsc.objsubid=attr.attnum     WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype ='f' AND con.conname =LOWER(a_ForeignKeyName)     ORDER BY con.No;\t <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_ForeignKey_ReferenceTableComplexFeatures<\/b>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <\/p>\n<p>  <a name=\"tfFKRCF_def\"><\/a>  <\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_ForeignKey_ReferenceTableComplexFeatures \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447<\/h4>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (<b>a_ForeignKey<\/b>) \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 (<b>a_SchemaName<\/b>).<\/p>\n<p>  <\/p>\n<p>\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_ForeignKeyNo<\/b>). \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0441\u0438\u043c\u0432\u043e\u043b <b>&#8216;%&#8217;<\/b> \u0432 \u00ab<b>fk%rtbl<\/b>\u00bb \u0438 \u00ab<b>fk%ratt<\/b>\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. <\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <a name=\"tfFKRF_def\"><\/a>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f <b>admtf_ForeignKey_ReferenceTableFeatures<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Table_Features<\/b>.<\/p>\n<p>  <a name=\"tfFKRA_def\"><\/a>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f <b>admtf_ForeignKey_ReferenceTableAttributes<\/b> \u2013 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430. \u041e\u043d\u0430 \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_ForeignKey_Attributes<\/b>. \u0422\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 <b>con.conrelid<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <b>con.confrelid<\/b>, \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <b>con.conkey<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <b>con.confkey<\/b>. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/q3\/65\/pt\/q365pt2qimldwrtvm2tc4hp3id8.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT (rank() OVER (PARTITION BY con.confrelid ORDER BY con.No))::SMALLINT,                attr.attnum AS r_AttributeNumber,attr.attname::NAME AS r_AttributeName,                CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME ELSE ''END,                FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                                  COALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::NAME,                attr.attnotnull AS r_isNotNULL,TRIM(dsc.description) AS r_Description      FROM (SELECT c.oid, c.conrelid,c.confrelid,c.conname,c.connamespace,c.contype,                            c.conkey::SMALLINT[],c.consrc,c.confkey::SMALLINT[],                            generate_subscripts(c.conkey, 1) as No                      FROM pg_constraint c) con            INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid           INNER JOIN pg_attribute attr ON attr.attrelid=con.confrelid                             AND attr.attnum=con.confkey[con.No]           INNER JOIN  pg_type typ ON attr.atttypid=typ.oid           LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid           LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                             AND dsc.objsubid=attr.attnum     WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype ='f'                            AND con.conname =LOWER(a_ForeignKeyName)     ORDER BY con.No;\t <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfIndexCF_def\"><\/a>  <\/p>\n<h3>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qf\/zc\/c5\/qfzcc57anv1ee-e9emxfpk3t3fq.png\"><br \/>  <i>\u0420\u0438\u0441. 6. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 admtf_Index_ComplexFeatures.<\/i><br \/>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 24. \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sx\/xr\/p_\/sxxrp_sis7kad6bkaymy0sz6e6e.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u2116<\/th>\n<th width=\"10\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"40\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">1<\/td>\n<td width=\"10\"><a href=\"#tfIndexCF\">admtf_Index_Features<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\"><a href=\"#tfIndexCF\">admtf_Index_Attributes<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441, \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">3<\/td>\n<td width=\"10\"><a href=\"#tfIndexCF\">admtf_Index_ComplexFeatures<\/a><\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441.<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_Index_ComplexFeatures \u2013 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Index_ComplexFeatures \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 25. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Index_ComplexFeatures (&#8216;public&#8217;,&#8217;xie9street&#8217;,7).<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2m\/jm\/or\/2mjmorpx-mzqp2qh__mc9qtnw0u.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f<\/th>\n<th width=\"5\">\u2116<\/th>\n<th width=\"15\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"5\">\u041f\u043e\u0440\u044f\u0434\u043e\u043a<\/th>\n<th width=\"20\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"20\"> \u0442\u0438\u043f<\/th>\n<th width=\"20\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f<\/th>\n<th width=\"5\">? not NULL<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">idx07<\/td>\n<td width=\"5\">7<\/td>\n<td width=\"15\">xie9street<\/td>\n<td width=\"5\"><\/td>\n<td width=\"20\">\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430 \u0432 \u0443\u0431\u044b\u0432\u0430\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx07att<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"5\">ASC<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx07att<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">localityid<\/td>\n<td width=\"5\">ASC<\/td>\n<td width=\"20\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">localityid<\/td>\n<td width=\"20\">integer<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx07att<\/td>\n<td width=\"5\">3<\/td>\n<td width=\"15\">streetname<\/td>\n<td width=\"5\">DESC<\/td>\n<td width=\"20\">\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\">VARCHAR(150)<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 (<b>a_ Index<\/b>) \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0434\u0435\u043a\u0441 (<b>a_SchemaName<\/b>).<\/p>\n<p>  <\/p>\n<p><a href=\"#tfIndexCF\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>  <\/p>\n<p>\u0423 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_IndexNo<\/b>). \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0430\u0432\u043d\u044b\u043c <b>7<\/b>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u00ab<b>idx07<\/b>\u00bb, \u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u2014 \u00ab<b>idx07att<\/b>\u00bb. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0432 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0431\u044b\u043b\u0438 \u0431\u044b \u00ab<b>idx<\/b>\u00bb \u0438 \u00ab<b>idxatt<\/b>\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c\u043e\u0442\u0440\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415575\/#ExpFeatures\">\u00ab\u041e \u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u0445 \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c?\u00bb<\/a>. \u041f\u043e \u044d\u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Index_ComplexFeatures<\/b>, \u0430 \u043d\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. <\/p>\n<p>  <a name=\"tfIndexF_def\"><\/a>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_Index_Features<\/b>) \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 SELECT, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9k\/vw\/jw\/9kvwjwe7fitrehc4l5vbszpxjos.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT inxcls.relname,        CASE WHEN COALESCE(TRIM(dsc.description),'')='' THEN            '\u0418\u043d\u0434\u0435\u043a\u0441'  || CASE WHEN inx.indisunique THEN ' \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439'            || CASE WHEN inx.indisprimary THEN '(\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447)' ELSE '' END ELSE '' END           ||CASE WHEN inxam.amname='gist' THEN ' \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439' ELSE '' END ||' \u0442\u0430\u0431\u043b\u0438\u0446\u044b '           ||tbl.relname                 ELSE dsc.description END\t      FROM pg_index inx                  INNER JOIN pg_class inxcls ON inx.indexrelid=inxcls.oid                 INNER JOIN pg_namespace nsp ON inxcls.relnamespace=nsp.oid                  LEFT OUTER JOIN pg_Description dsc ON inxcls.oid=dsc.objoid                                                 AND dsc.objsubid=0                  LEFT OUTER JOIN pg_am inxam ON inxcls.relam=inxam.oid                 LEFT OUTER JOIN pg_class tbl ON inx.indrelid=tbl.oid      WHERE inxcls.relkind='i' AND nsp.nspname =LOWER(a_SchemaName)                AND inxcls.relname=LOWER(a_IndexName); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfIndexA_def\"><\/a>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (<b>admtf_ Index_Attributes<\/b>) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0431 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0438\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0435 (<b>inx.No<\/b>), \u0430 \u043d\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (<b>attr.attnum<\/b>).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tr\/uz\/7g\/truz7g_xcuskbjpvogxmvto-uca.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">SELECT (inx.No+1)::SMALLINT,attr.attnum::SMALLINT, attr.attname::NAME,               CASE WHEN NOT inxam.amcanorder THEN NULL                                            ELSE                CASE WHEN inx.indoption[inx.No] &amp; 1=1 THEN 'DESC'                                            ELSE 'ASC' END END::VARCHAR(10),               CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME ELSE '' END,               FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                                COALESCE(NULLIF(typ.typtypmod,-),attr.atttypmod))::NAME,               attr.attnotnull,dsc.description      FROM (SELECT i.indrelid, i.indexrelid,i.indkey::SMALLINT[], i.indoption::SMALLINT[],                             generate_subscripts(i.indkey, 1) as No FROM pg_index i) inx             INNER JOIN pg_class inxcls ON inx.indexrelid=inxcls.oid             INNER JOIN pg_namespace nsp ON inxcls.relnamespace=nsp.oid             LEFT OUTER JOIN pg_am inxam ON inxcls.relam=inxam.oid            LEFT OUTER JOIN pg_class tbl ON inx.indrelid=tbl.oid            INNER JOIN pg_attribute attr ON attr.attrelid=tbl.oid AND attr.attnum=inx.indkey[inx.No]            LEFT OUTER JOIN pg_type typ ON attr.atttypid=typ.oid            LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid            LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                                           AND dsc.objsubid=attr.attnum     WHERE nsp.nspname=LOWER(a_SchemaName) AND inxcls.relkind='i'                                            AND inxcls.relname =LOWER(a_IndexName)     ORDER BY nsp.nspname,inxcls.relname,inx.No; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415897\/#tfTableI_def\">\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_Indexes<\/b> \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a.<\/a><\/p>\n<p>  <a name=\"tfTableCF_def\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_ComplexFeatures<\/h3>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_ComplexFeatures<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_TableName<\/b>) \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (<b>a_SchemaName<\/b>).<\/p>\n<p>  <\/p>\n<p><a href=\"#tfTableCF\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 26. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_ComplexFeatures(&#8216;public&#8217;, &#8216;street&#8217;).<\/strong><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zj\/5x\/jn\/zj5xjnygaeedplccbe_itjr7fpu.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u043a\u0441\u0442\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"5\">\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f<\/th>\n<th width=\"5\">\u2116<\/th>\n<th width=\"15\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"20\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"20\"> \u0442\u0438\u043f<\/th>\n<th width=\"20\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f<\/th>\n<th width=\"5\">? not NULL<\/th>\n<\/tr>\n<tr>\n<td width=\"5\">tbl<\/td>\n<td width=\"5\">0<\/td>\n<td width=\"15\">street<\/td>\n<td width=\"20\">\u0421\u043f\u0438\u0441\u043e\u043a \u0443\u043b\u0438\u0446 \u0432 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">att<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">att<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">localityid<\/td>\n<td width=\"20\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">localityid<\/td>\n<td width=\"20\">integer<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">att<\/td>\n<td width=\"5\">3<\/td>\n<td width=\"15\">streetid<\/td>\n<td width=\"20\">\u0418\u0414 \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\">streetid<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">att<\/td>\n<td width=\"5\">4<\/td>\n<td width=\"15\">streettypeacrm<\/td>\n<td width=\"20\">\u0410\u043a\u0440\u043e\u043d\u0438\u043c \u0442\u0438\u043f\u0430 \u0443\u043b\u0438\u0446\u044b<\/td>\n<td width=\"20\">streettypeacrm<\/td>\n<td width=\"20\">character(8)<\/td>\n<td width=\"5\">f<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">att<\/td>\n<td width=\"5\">5<\/td>\n<td width=\"15\">streetname<\/td>\n<td width=\"20\">\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u043b\u0438\u0446\u044b<\/td>\n<td width=\"20\">streettypeacrm<\/td>\n<td width=\"20\">varchar(150)<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">pk<\/td>\n<td width=\"5\">0<\/td>\n<td width=\"15\">xpkstreet<\/td>\n<td width=\"20\">\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b street<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">pkatt<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">wcrccode<\/td>\n<td width=\"20\">\u041a\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u044b<\/td>\n<td width=\"20\">wcrccode<\/td>\n<td width=\"20\">smallint<\/td>\n<td width=\"5\">t<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk01<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">fk_street_locality<\/td>\n<td width=\"20\">\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">fk02<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">fk_street_streettype<\/td>\n<td width=\"20\">\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx01<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"15\">xie1street<\/td>\n<td width=\"20\">\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u0442\u0438\u043f\u0443 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx02<\/td>\n<td width=\"5\">2<\/td>\n<td width=\"15\">xie2street<\/td>\n<td width=\"20\">\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0443\u043b\u0438\u0446\u044b \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx03<\/td>\n<td width=\"5\">3<\/td>\n<td width=\"15\">xie3street<\/td>\n<td width=\"20\">\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c \u0443\u043b\u0438\u0446 \u0432\u0441\u0435\u0445 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<tr>\n<td width=\"5\">idx04<\/td>\n<td width=\"5\">4<\/td>\n<td width=\"15\">xpkstreet<\/td>\n<td width=\"20\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 (\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447) \u0442\u0430\u0431\u043b\u0438\u0446\u044b street<\/td>\n<td width=\"20\"><\/td>\n<td width=\"20\"><\/td>\n<td width=\"5\"><\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 9 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"https:\/\/habr.com\/post\/415575\/#tfTableCF_def\">\u00ab\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00bb<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e <a href=\"https:\/\/habr.com\/post\/415575\/#ExpFeatures\">\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/a>.<\/p>\n<h3>\u0413\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438?<\/h3>\n<p>  <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/k_\/m-\/8-\/k_m-8-txvg5otvfioygbkoxqiim.png\" alt=\"left\" width=\"200\" height=\"100\">\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e\u0434\u0430\u0447\u0438 \u0437\u0430\u044f\u0432\u043a\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435 \u00ab\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043b\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0438\u043b\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb, \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043a\u0430\u0437\u043e\u043c \u041c\u0438\u043d\u044d\u043a\u043e\u043d\u043e\u043c\u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0420\u043e\u0441\u0441\u0438\u0438 \u043e\u0442 5 \u0430\u043f\u0440\u0435\u043b\u044f 2016 \u0433\u043e\u0434\u0430 N 211 (\u0434\u0430\u043b\u0435\u0435 \u041f\u0440\u0430\u0432\u0438\u043b\u0430).<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0437\u0430\u044f\u0432\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u00ab\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb. \u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0442\u0440\u0430\u043a\u0442\u0443\u044e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. <\/p>\n<blockquote><p>\u00ab\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0440\u0430\u0436\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445\u0441\u044f \u0432 \u043d\u0435\u0439 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u042d\u0412\u041c.\u00bb<\/p><\/blockquote>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0435\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jv\/zx\/7k\/jvzx7kx5y_qe6rc4lzbtomutqwa.png\">  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0440\u0438\u0441\u0443\u043d\u043a\u0430, \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0437\u0430\u044f\u0432\u043a\u0438 \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b 3- 4 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 <b>PlantUML<\/b>.\u0422\u043e\u0447\u043d\u0435\u0435, \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043a\u043e\u0434 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <a href=\"https:\/\/trac-hacks.org\/wiki\/PlantUmlMacro\">\u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/a> \u0434\u043b\u044f <a href=\"https:\/\/habr.com\/post\/20309\/\">\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 TRAC<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.planttext.com\/\">\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c<\/a> \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u0442\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043a\u043e\u0434, \u0442\u043e \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u0431\u0440\u0430\u0442\u044c \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0441\u0432\u0435\u0440\u0445\u0443 \u043f\u0435\u0440\u0435\u0434 <b>@startuml<\/b> \u0438 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0441\u043d\u0438\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <b>@enduml<\/b>. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043a\u043e\u0434 PlantUML \u0441\u043a\u0440\u0438\u043f\u0442\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">{{{ #!plantuml @startuml object public.ID_DISTRICTS{ id_np : integer NOT NULL (PK1)(FK1 id_nps(id_np)) id_district : integer NOT NULL (PK2) name_district : character varying(25) NULL  type_district : character varying(25) NULL  okato : character varying(11) NULL  oktmo : character varying(11) NULL  } object public.ID_NPS{ id_region : integer NOT NULL (FK1 id_regions(id_region)) id_atu : integer NULL (FK1 id_rayons(id_atu)) id_selsov : integer NULL (FK1 id_selsovs(id_selsov)) id_np : integer NOT NULL (PK1) name_np : character varying(25) NULL  type_np : character varying(25) NULL (FK1 type_np(scname)) okato : character varying(11) NULL  oktmo : character varying(11) NULL  } public.ID_DISTRICTS *-- public.ID_NPS legend center &lt;b&gt;&lt;i&gt;&lt;u&gt;\u0422\u0410\u0411\u041b\u0418\u0426\u042b&lt;\/u&gt;&lt;\/i&gt;&lt;\/b&gt;   &lt;b&gt;ID_DISTRICTS&lt;\/b&gt;- \u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a - \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u043e\u0440\u043e\u0434\u0441\u043a\u0438\u0445 \u0440\u0430\u0439\u043e\u043d\u043e\u0432  &lt;b&gt;ID_NPS&lt;\/b&gt;- \u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a - \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u043e\u0432  endlegend @enduml }}}   ----  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p><b>P.S.<\/b> \u041f\u043e\u0447\u0435\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 PlantUML \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 TRAC? \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u043d\u0438 \u043d\u0435 \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0442\u0435\u043c\u0443. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u043e\u0445\u043e\u0436\u0435, \u044f \u0443\u0442\u043e\u043c\u0438\u043b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041d\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u0442\u043e \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435, \u0438 \u044f \u0432\u044b\u0448\u043b\u044e \u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u044b.<\/p>\n<p>  <\/p>\n<p><b>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/415575\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f<\/a>;<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/415897\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u0430\u044f<\/a>;<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/418597\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f<\/a>.<\/b><\/p>\n<p>  <a name=\"Script2\"><\/a><\/p>\n<h2>\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u0415 1. \u0421\u043a\u0440\u0438\u043f\u0442\u044b<\/h2>\n<p>  <a name=\"tfPKCF\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_PrimaryKey_ComplexFeatures<\/h3>\n<p>  <a href=\"#tfPKCF_def\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\"><a name=\"tfPKF\"><\/a>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_PrimaryKey_Features<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_Features (a_SchemaName NAME,a_PrimaryKeyName NAME); \/******************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e  *\/ \/* \u0441\u0445\u0435\u043c\u0435                                                                                                                                 *\/ \/******************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_Features    (a_SchemaName NAME default 'public',  \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_PrimaryKeyName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  ) RETURNS TABLE (rs_PrimaryKeyName NAME,rs_PrimaryKeyDescription TEXT) AS $BODY$ DECLARE c_PrimaryKeyKind CONSTANT CHAR:='p';         v_PrimaryKeyOID    OID;   \/* \u0418\u0414 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/         v_PrimaryKeyName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/         v_PrimaryKeyDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/         v_MasterTableName NAME;\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 *\/ --*******************************************************************\t\t BEGIN\t\t        SELECT INTO rs_PrimaryKeyName,rs_PrimaryKeyDescription                    con.conname,COALESCE(dsc.description,'\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b '|| tbl.relname)              FROM pg_constraint con                        INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                        INNER JOIN pg_class tbl ON con.conrelid=tbl.oid                       LEFT OUTER JOIN pg_Description dsc ON con.oid=dsc.objoid                                                                   AND dsc.objsubid=0            WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype =c_PrimaryKeyKind                       AND con.conname =LOWER(a_PrimaryKeyName);        RETURN QUERY SELECT rs_PrimaryKeyName,rs_PrimaryKeyDescription;\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_Features(a_SchemaName NAME,a_PrimaryKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_Features (a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)); \/******************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e *\/ \/*  \u0441\u0445\u0435\u043c\u0435                                                                                                                               *\/ \/******************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_Features      (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_PrimaryKeyName VARCHAR(256) default NULL   \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  ) RETURNS  TABLE (rs_PrimaryKeyName VARCHAR(256),rs_PrimaryKeyDescription TEXT) AS $BODY$ DECLARE\tc_PrimaryKeyKind\tCONSTANT CHAR:='p'; --******************************************************************\t\t BEGIN\t\t    RETURN QUERY SELECT pkf.rs_PrimaryKeyName::VARCHAR(256),                                        pkf.rs_PrimaryKeyDescription::TEXT         FROM admtf_PrimaryKey_Features(a_SchemaName::NAME,a_PrimaryKeyName::NAME) pkf;\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_Features(a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_PrimaryKey_Features('public'::NAME,'xpkstreet'::NAME); SELECt * FROM admtf_PrimaryKey_Features('public'::VARCHAR(256),'xpkstreet'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_PrimaryKey_Attributes<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_Attributes (a_SchemaName NAME,a_PrimaryKeyName NAME); \/********************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/ \/********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_Attributes      (a_SchemaName\tNAME default 'public',\t\/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\t\t*\/        a_PrimaryKeyName\tNAME default NULL\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_PrimaryKeyNo SMALLINT,r_AttributeNumber SMALLINT,      r_AttributeName NAME,r_UserTypeName NAME,r_TypeName NAME,      r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE\t      c_PrimaryKeyKind\tCONSTANT CHAR:='p';      v_PrimaryKeyOID OID; \/* \u0418\u0414 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      v_PrimaryKeyName NAME;        \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      v_PrimaryKeyDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      v_MasterTableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 *\/      v_PrimaryKeyArray SMALLINT[]; \/* \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043d\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/      v_MasterTableOID OID; \/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 *\/      v_AttributeNumber SMALLINT; \/* \u041d\u043e\u043c\u0435\u0440 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/      v_PKAttributeCount SMALLINT; \/* \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/      v_AttNo SMALLINT; \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ --**********************************************************************\t\t BEGIN\t\t \tRETURN QUERY SELECT (rank() OVER (PARTITION BY con.conrelid ORDER BY                                                       attr.attnum))::SMALLINT AS r_PrimaryKeyNo,              attr.attnum AS r_AttributeNumber,attr.attname::NAME AS r_AttributeName,              CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME                                                        ELSE ''::NAME END AS r_UserTypeName,              FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                           COALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::NAME AS r_TypeName,              attr.attnotnull AS r_isNotNULL,             TRIM(dsc.description) AS r_Description         FROM (SELECT c.oid, c.conrelid,c.connamespace,c.confrelid,c.conname,                           c.contype,c.conkey::SMALLINT[], \t\t\t  consrc, c.confkey::SMALLINT[],generate_subscripts(c.conkey, 1) as No                       FROM pg_constraint c) con                           INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                           INNER JOIN pg_attribute attr ON attr.attrelid=con.conrelid                                         AND attr.attnum=con.conkey[con.No]                           LEFT OUTER JOIN pg_type typ ON attr.atttypid=typ.oid                           LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid                           LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                                        AND dsc.objsubid=attr.attnum          WHERE con.contype=c_PrimaryKeyKind                    AND LOWER(nspc.nspname)=LOWER(a_SchemaName)                    AND LOWER(con.conname)=LOWER(a_PrimaryKeyName)           ORDER BY attr.attnum; \tRETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_Attributes(a_SchemaName NAME,a_PrimaryKeyName NAME) IS '\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a '; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_Attributes (a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)); \/********************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/ \/********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_Attributes     (a_SchemaName VARCHAR(256) default 'public',  \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_PrimaryKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  ) RETURNS  TABLE (r_PrimaryKeyNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName VARCHAR(256),r_UserTypeName VARCHAR(256),r_TypeName VARCHAR(256),r_isNotNULL BOOLEAN,r_Description TEXT) AS $BODY$ DECLARE\t     c_PrimaryKeyKind\tCONSTANT CHAR:='p'; --*******************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT pka.r_PrimaryKeyNo::SMALLINT,pka.r_AttributeNumber::SMALLINT,                              pka.r_AttributeName::VARCHAR(256),pka.r_UserTypeName::VARCHAR(256),                              pka.r_TypeName::VARCHAR(256),pka.r_isNotNULL::BOOLEAN,                              pka.r_Description::TEXT          FROM admtf_PrimaryKey_Attributes(a_SchemaName::NAME,a_PrimaryKeyName::NAME) pka; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_Attributes(a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)) IS '\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0438 \u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION;  SELECt * FROM admtf_PrimaryKey_Attributes('public'::NAME,'xpkstreet'::NAME); SELECt * FROM admtf_PrimaryKey_Attributes('public'::VARCHAR(256),'xpkstreet'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_ComplexFeatures (a_SchemaName NAME,a_PrimaryKeyName NAME); \/*****************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 *\/ \/*  \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432\t                                                   *\/ \/*****************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_ComplexFeatures     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_PrimaryKeyName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t  RETURNS  TABLE (rpk_FeatureCategory VARCHAR(10),rpk_FeatureNumber SMALLINT,rpk_FeatureName NAME,rpk_FeatureDescription TEXT, rpk_UserTypeName NAME,rpk_TypeName NAME,rpk_isNotNULL BOOLEAN) AS $BODY$ DECLARE     c_PrimaryKeyCategory CONSTANT VARCHAR(10):='pk';\t\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a  *\/                                                                \/* \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     c_AttributeCategory CONSTANT VARCHAR(10):='pkatt'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432*\/                                                                \/* \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_PrimaryKeyOID OID;\t\t    \/* \u0418\u0414 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_PrimaryKeyName NAME;         \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_PrimaryKeyDescription TEXT;  \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_FeatureCategory VARCHAR(10); \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 *\/     v_FeatureNumber SMALLINT; \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438*\/\t --***********************************************************************\t\t BEGIN\t     v_FeatureCategory:=c_PrimaryKeyCategory;     v_FeatureNumber:=0;     SELECT INTO v_PrimaryKeyName,v_PrimaryKeyDescription                       rs_PrimaryKeyName,rs_PrimaryKeyDescription         FROM admtf_PrimaryKey_Features(a_SchemaName,a_PrimaryKeyName);     IF FOUND AND v_PrimaryKeyName IS NOT NULL THEN\t\t         RETURN QUERY SELECT v_FeatureCategory,v_FeatureNumber,v_PrimaryKeyName,                        v_PrimaryKeyDescription,                        NULL::NAME AS rpk_UserTypeName, NULL::NAME AS rpk_TypeName,                        NULL::BOOLEAN AS rpk_isNotNULL;         v_FeatureCategory:=c_AttributeCategory;         v_FeatureNumber:=0;         RETURN QUERY SELECT v_FeatureCategory,r_PrimaryKeyNo,r_AttributeName,r_Description,                       r_UserTypeName,r_TypeName,r_isNotNULL              FROM  admtf_PrimaryKey_Attributes(a_SchemaName,a_PrimaryKeyName);      END IF;\t\t\t      RETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_ComplexFeatures(a_SchemaName NAME,a_PrimaryKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_PrimaryKey_ComplexFeatures (a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)); \/******************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439  *\/ \/* \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432                                                           *\/ \/******************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_PrimaryKey_ComplexFeatures     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_PrimaryKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  ) RETURNS  TABLE (rpk_FeatureCategory VARCHAR(10),rpk_FeatureNumber SMALLINT,rpk_FeatureName VARCHAR(256),rpk_FeatureDescription TEXT, rpk_UserTypeName VARCHAR(256),rpk_TypeName VARCHAR(256),rpk_isNotNULL BOOLEAN) AS $BODY$ DECLARE     c_PrimaryKeyCategory CONSTANT VARCHAR(10):='pk'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/                                                                           \/* \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ --*************************************************************************\t\t BEGIN\t \tRETURN QUERY SELECT pk.rpk_FeatureCategory::VARCHAR(10),                     pk.rpk_FeatureNumber::SMALLINT,                     pk.rpk_FeatureName::VARCHAR(256),pk.rpk_FeatureDescription::TEXT,                     pk.rpk_UserTypeName::VARCHAR(256),pk.rpk_TypeName::VARCHAR(256),                     pk.rpk_isNotNULL::BOOLEAN            FROM  admtf_PrimaryKey_ComplexFeatures(a_SchemaName::NAME,                                                          a_PrimaryKeyName::NAME) pk; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_PrimaryKey_ComplexFeatures(a_SchemaName VARCHAR(256),a_PrimaryKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION;  SELECt * FROM admtf_PrimaryKey_ComplexFeatures('public'::NAME,'xpkstreet'::NAME); SELECt * FROM admtf_PrimaryKey_ComplexFeatures('public'::VARCHAR(256),'xpkstreet'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfFKCF\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_ComplexFeatures<\/h3>\n<p>  <a href=\"#tfFKCF_def\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_Features<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_Features (a_SchemaName NAME,a_ForeignKeyName NAME); \/**************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435                                                                       *\/ \/**************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_Features     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_ForeignKeyName NAME,rs_ForeignKeyDescription TEXT) AS $BODY$ DECLARE\tc_ForeignKeyKind\tCONSTANT CHAR:='f';     v_ForeignKeyOID OID;            \/* \u0418\u0414 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_ForeignKeyName  NAME;      \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_ForeignKeyDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     v_MasterTableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 *\/ --************************************************************************\t\t BEGIN\t\t     SELECT INTO rs_ForeignKeyName,rs_ForeignKeyDescription                     con.conname,COALESCE(dsc.description,'\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u0442\u0430\u0431\u043b\u0438\u0446\u044b '|| tbl.relname)         FROM pg_constraint con           INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid           INNER JOIN pg_class tbl ON con.conrelid=tbl.oid          LEFT OUTER JOIN pg_Description dsc ON con.oid=dsc.objoid                               AND dsc.objsubid=0       WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype =c_ForeignKeyKind                            AND con.conname =LOWER(a_ForeignKeyName);    RETURN QUERY SELECT rs_ForeignKeyName,rs_ForeignKeyDescription;\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_Features(a_SchemaName NAME,a_ForeignKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_Features (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)); \/********************************************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435\t\t\t\t*\/ \/********************************************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_Features    (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/    a_ForeignKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_ForeignKeyName VARCHAR(256),rs_ForeignKeyDescription TEXT) AS $BODY$ DECLARE c_ForeignKeyKind CONSTANT CHAR:='f'; \t--*******************************************************************\t\t BEGIN\t\t    RETURN QUERY SELECT fkf.rs_ForeignKeyName::VARCHAR(256),                                  fkf.rs_ForeignKeyDescription::TEXT                               FROM admtf_ForeignKey_Features                                              (a_SchemaName::NAME,a_ForeignKeyName::NAME) fkf; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_Features(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_Features('public'::VARCHAR(256),'fk_street_locality'::VARCHAR(256)); SELECt * FROM admtf_ForeignKey_Features('public'::NAME,'fk_street_locality'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_Attributes<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_Attributes (a_SchemaName NAME,a_ForeignKeyName NAME); \/**************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435                                                                       *\/ \/**************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_Attributes     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_ForeignKeyName\t NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_ForeignKeyNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName NAME,r_UserTypeName NAME,r_TypeName NAME,r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE c_ForeignKeyKind CONSTANT CHAR:='f'; --****************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT (rank() OVER (PARTITION BY con.conrelid ORDER BY con.No))::SMALLINT                                                                                 AS r_ForeingKeyNo,                                 attr.attnum AS r_AttributeNumber,attr.attname::NAME AS r_AttributeName,                                 CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME                                           ELSE ''END AS r_UserTypeName, \t\t\t\tFORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                                             COALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::NAME                                                                                   AS r_TypeName,\t\t\t\t                                 attr.attnotnull AS r_isNotNULL,TRIM(dsc.description) AS r_Description                     FROM (SELECT c.oid, c.conrelid,c.confrelid,c.conname,c.connamespace,                                         c.contype,c.conkey::SMALLINT[],c.consrc, c.confkey::SMALLINT[],                                         generate_subscripts(c.conkey, 1) as No FROM pg_constraint c) con                              INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid                             INNER JOIN pg_attribute attr ON attr.attrelid=con.conrelid                                     AND attr.attnum=con.conkey[con.No]                             INNER JOIN  pg_type typ ON attr.atttypid=typ.oid                             LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid                             LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                                     AND dsc.objsubid=attr.attnum                     WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype =c_ForeignKeyKind                                     AND con.conname =LOWER(a_ForeignKeyName)                     ORDER BY con.No;\t\t\t     RETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_Attributes(a_SchemaName NAME,a_ForeignKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_Attributes (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)); \/**************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/* \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435                                                                        *\/ \/**************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_Attributes     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_ForeignKeyNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName VARCHAR(256),r_UserTypeName VARCHAR(256),r_TypeName VARCHAR(256),r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE c_ForeignKeyKind\t CONSTANT CHAR:='f'; --*****************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT fka.r_ForeignKeyNo::SMALLINT,fka.r_AttributeNumber::SMALLINT,                                 fka.r_AttributeName::VARCHAR(256),                                 fka.r_UserTypeName::VARCHAR(256),fka.r_TypeName::VARCHAR(256),                                 fka.r_isNotNULL::BOOLEAN,fka.r_Description::TEXT     FROM admtf_ForeignKey_Attributes(a_SchemaName::NAME,a_ForeignKeyName::NAME) fka; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_Attributes(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_Attributes('public'::NAME,'fk_mapHouse_MapStreet'::NAME); SELECt * FROM admtf_ForeignKey_Attributes('public'::NAME,'fk_street_locality'::NAME); SELECt * FROM admtf_ForeignKey_Attributes('public'::NAME,'fk_street_streettype'::NAME); SELECt * FROM admtf_ForeignKey_Attributes('public'::VARCHAR(256),'fk_street_locality'::VARCHAR(256)); SELECt * FROM admtf_ForeignKey_Attributes('public'::VARCHAR(256),'fk_street_streettype'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_ReferenceTableComplexFeatures<\/h3>\n<p>  <a href=\"#tfFKRCF_def\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_ReferenceTableFeatures<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableFeatures (a_SchemaName NAME,a_ForeignKeyName NAME); \/*******************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f *\/ \/*   \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447                                                                                            *\/ \/*******************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableFeatures     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rfkrt_ReferenceTableName NAME,rfkrt_ReferenceTableDescription TEXT) AS $BODY$ DECLARE c_ForeignKeyKind\tCONSTANT CHAR:='f';  v_ReferenceTableOID OID; \/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/  v_ReferenceTableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447*\/  v_ReferenceTableDescription TEXT; \/*\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/  v_MasterTableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439  \u043a\u043b\u044e\u0447 *\/ --*******************************************************************\t\t BEGIN\t\t     SELECT INTO v_ReferenceTableName rtbl.relname         FROM pg_constraint con              INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid              INNER JOIN pg_class rtbl ON con.confrelid=rtbl.oid         WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype =c_ForeignKeyKind                 AND con.conname =LOWER(a_ForeignKeyName);     IF FOUND THEN\t\t\t\t         RETURN QUERY SELECT rs_TableName,rs_TableDescription FROM                 admtf_Table_Features(a_SchemaName,v_ReferenceTableName);\t     END IF;\t     RETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableFeatures(a_SchemaName NAME,a_ForeignKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableFeatures (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)); \/*******************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f *\/ \/*   \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447                                                                                            *\/ \/******************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableFeatures     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  ) RETURNS  TABLE (rfkrt_ReferenceTableName VARCHAR(256),rfkrt_ReferenceTableDescription TEXT) AS $BODY$ DECLARE c_ForeignKeyKind CONSTANT CHAR:='f'; --*********************************************************************\t\t BEGIN\t\t      RETURN QUERY SELECT fkrt.rfkrt_ReferenceTableName::VARCHAR(256),                                 fkrt.rfkrt_ReferenceTableDescription::TEXT     FROM admtf_ForeignKey_ReferenceTableFeatures(a_SchemaName::NAME,                                 a_ForeignKeyName::NAME) fkrt; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableFeatures(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_ReferenceTableFeatures('public'::VARCHAR(256),'fk_street_locality'::VARCHAR(256)); SELECt * FROM admtf_ForeignKey_ReferenceTableFeatures('public'::NAME,'fk_street_locality'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_ForeignKey_ReferenceTableAttributes<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableAttributes (a_SchemaName NAME,a_ForeignKeyName NAME); \/******************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e *\/ \/*  \u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447                                                                              *\/ \/******************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableAttributes     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t  RETURNS TABLE(r_ReferenceTableKeyNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName NAME,r_UserTypeName NAME,r_TypeName NAME,r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE c_ForeignKeyKind\t CONSTANT CHAR:='f'; v_ForeignKeyName NAME;\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyDescription TEXT;\/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ReferenceTableKeyArray SMALLINT[];\/* \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043d\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, *\/                                                   \/* \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ v_ReferenceTableName NAME;\/* \u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ v_ReferenceTableDescription TEXT;\/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ v_ReferenceTableOID OID; \/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ v_AttributeNumber SMALLINT;\t\/* \u041d\u043e\u043c\u0435\u0440 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/ v_FKAttributeCount INTEGER;    \/* \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ v_AttNo SMALLINT;                   \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \t--******************************************************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT (rank() OVER (PARTITION BY con.confrelid                                              ORDER BY con.No))::SMALLINT AS r_ReferenceTableKeyNo,                             attr.attnum AS r_AttributeNumber,attr.attname::NAME AS r_AttributeName,                             CASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::NAME                                     ELSE ''END AS r_UserTypeName,                             FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                                             COALESCE(NULLIF(typ.typtypmod,-1),                                                     attr.atttypmod))::NAME AS r_TypeName,\t\t\t\t                             attr.attnotnull AS r_isNotNULL,TRIM(dsc.description) AS r_Description      FROM (SELECT c.oid, c.conrelid,c.confrelid,c.conname,c.connamespace,c.contype,                 c.conkey::SMALLINT[],c.consrc, c.confkey::SMALLINT[],                 generate_subscripts(c.conkey, 1) as No FROM pg_constraint c) con          INNER JOIN pg_namespace nspc ON con.connamespace = nspc.oid         INNER JOIN pg_attribute attr ON attr.attrelid=con.confrelid                                     AND attr.attnum=con.confkey[con.No]         INNER JOIN  pg_type typ ON attr.atttypid=typ.oid         LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid         LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                                     AND dsc.objsubid=attr.attnum         WHERE nspc.nspname=LOWER(a_SchemaName) AND con.contype =c_ForeignKeyKind                 AND con.conname =LOWER(a_ForeignKeyName)         ORDER BY con.No;\t\t\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableAttributes(a_SchemaName NAME,a_ForeignKeyName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableAttributes (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)); \/*********************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*   \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447                                         *\/ \/********************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableAttributes     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_ForeignKeyName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_ReferenceTableKeyNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName VARCHAR(256),r_UserTypeName VARCHAR(256),r_TypeName VARCHAR(256),r_isNotNULL BOOLEAN,r_Description TEXT) AS $BODY$ DECLARE c_ForeignKeyKind CONSTANT CHAR:='f'; --****************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT fkra.r_ReferenceTableKeyNo::SMALLINT,                             fkra.r_AttributeNumber::SMALLINT,fkra.r_AttributeName::VARCHAR(256),                             fkra.r_UserTypeName::VARCHAR(256),fkra.r_TypeName::VARCHAR(256),                             fkra.r_isNotNULL::BOOLEAN,fkra.r_Description::TEXT     FROM admtf_ForeignKey_ReferenceTableAttributes(a_SchemaName::NAME,                                         a_ForeignKeyName::NAME) fkra; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableAttributes(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_ReferenceTableAttributes('public'::VARCHAR(256),'fk_street_locality'::VARCHAR(256)); SELECt * FROM admtf_ForeignKey_ReferenceTableAttributes('public'::NAME,'fk_street_locality'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableComplexFeatures (a_SchemaName NAME,a_ForeignKeyName NAME,a_ForeignKeyNo SMALLINT); \/*************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e            *\/ \/* \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 *\/ \/*************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableComplexFeatures     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName NAME default NULL, \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      a_ForeignKeyNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (fkrt_FeatureCategory VARCHAR(10),fkrt_FeatureNumber SMALLINT,fkrt_FeatureName NAME,fkrt_FeatureDescription TEXT,fkrt_UserTypeName NAME,fkrt_TypeName NAME,fkrt_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%';\t c_ForeignKeyCategory CONSTANT VARCHAR(10):='fk'||c_WildChar||'rtbl'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                   \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ c_AttributeCategory CONSTANT VARCHAR(10):='fk'||c_WildChar||'ratt';\t\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                         \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 *\/ v_ForeignKeyCharNo VARCHAR(2); \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t v_ForeignKeyOID OID;                  \/* \u0418\u0414 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyName NAME;             \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyDescription TEXT;      \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_FeatureCategory VARCHAR(10); \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 *\/ v_FeatureNumber SMALLINT;      \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438*\/\t --*********************************************************************\t\t BEGIN\t     v_ForeignKeyCharNo:=COALESCE(TRIM(TO_CHAR(a_ForeignKeyNo,'09')),'');     v_FeatureCategory:=REPLACE(c_ForeignKeyCategory,c_WildChar, v_ForeignKeyCharNo);     v_FeatureNumber:=0;     SELECT INTO v_ForeignKeyName,v_ForeignKeyDescription                 rfkrt_ReferenceTableName,rfkrt_ReferenceTableDescription         FROM admtf_ForeignKey_ReferenceTableFeatures(a_SchemaName,a_ForeignKeyName);     IF FOUND AND v_ForeignKeyName IS NOT NULL THEN\t\t         RETURN QUERY SELECT                  v_FeatureCategory,v_FeatureNumber,v_ForeignKeyName,                 v_ForeignKeyDescription,NULL::NAME AS fkrt_UserTypeName,                  NULL::NAME AS fkrt_TypeName, NULL::BOOLEAN AS fkrt_isNotNULL ;     END IF;\t\t\t     v_FeatureCategory:=REPLACE(c_AttributeCategory,c_WildChar, v_ForeignKeyCharNo);     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,r_ReferenceTableKeyNo,r_AttributeName,                 r_Description,r_UserTypeName,r_TypeName,r_isNotNULL         FROM  admtf_ForeignKey_ReferenceTableAttributes(a_SchemaName,a_ForeignKeyName); END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableComplexFeatures(a_SchemaName NAME,a_ForeignKeyName NAME,a_ForeignKeyNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ReferenceTableComplexFeatures (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256),a_ForeignKeyNo SMALLINT); \/*************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e            *\/ \/* \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 *\/ \/*************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ReferenceTableComplexFeatures     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_ForeignKeyName\t VARCHAR(256) default NULL,\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \t*\/     a_ForeignKeyNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (fkrt_FeatureCategory VARCHAR(10),fkrt_FeatureNumber SMALLINT,fkrt_FeatureName VARCHAR(256),fkrt_FeatureDescription TEXT, fkrt_UserTypeName VARCHAR(256),fkrt_TypeName VARCHAR(256),fkrt_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%';\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/                                                          \/* \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/\t\t --******************************************************************\t\t BEGIN\t     RETURN QUERY SELECT fkrt.fkrt_FeatureCategory::VARCHAR(10),                             fkrt.fkrt_FeatureNumber::SMALLINT,                             fkrt.fkrt_FeatureName::VARCHAR(256),fkrt.fkrt_FeatureDescription::TEXT,                             fkrt.fkrt_UserTypeName::VARCHAR(256),                             fkrt.fkrt_TypeName::VARCHAR(256),fkrt.fkrt_isNotNULL::BOOLEAN     FROM  admtf_ForeignKey_ReferenceTableComplexFeatures(a_SchemaName::NAME,                                     a_ForeignKeyName::NAME,a_ForeignKeyNo::SMALLINT ) fkrt; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ReferenceTableComplexFeatures(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256),a_ForeignKeyNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_ReferenceTableComplexFeatures('public'::NAME,'fk_street_locality'::NAME); SELECt * FROM admtf_ForeignKey_ReferenceTableComplexFeatures('public'::NAME,'fk_street_locality'::NAME,10::SMALLINT); SELECt * FROM admtf_ForeignKey_ReferenceTableComplexFeatures('public'::VARCHAR(256),'fk_street_locality'::VARCHAR(256),10::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ComplexFeatures (a_SchemaName NAME,a_ForeignKeyName NAME,a_ForeignKeyNo SMALLINT); \/**************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432   *\/ \/**************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ComplexFeatures     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445\t\t*\/      a_ForeignKeyName NAME default NULL,\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      a_ForeignKeyNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rfk_FeatureCategory VARCHAR(10),rfk_FeatureNumber SMALLINT,rfk_FeatureName NAME,rfk_FeatureDescription TEXT, rfk_UserTypeName NAME,rfk_TypeName NAME,rfk_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%'; c_ForeignKeyCategory CONSTANT VARCHAR(10):='fk'||c_WildChar; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/                                                                                \/* \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_AttributeCategory CONSTANT VARCHAR(10):='fk'||c_WildChar||'att'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                                                              \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a *\/                                                                                \/* \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyOID OID; \/* \u0418\u0414 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyCharNo VARCHAR(2); \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t v_ForeignKeyDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_FeatureCategory VARCHAR(10); \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 *\/ v_FeatureNumber SMALLINT; \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438*\/\t --************************************************************************\t\t BEGIN     v_ForeignKeyCharNo:=COALESCE(TRIM(TO_CHAR(a_ForeignKeyNo,'09')),'');     v_FeatureCategory:=REPLACE(c_ForeignKeyCategory,c_WildChar, v_ForeignKeyCharNo);     v_FeatureNumber:=0;     SELECT INTO v_ForeignKeyName,v_ForeignKeyDescription             rs_ForeignKeyName,rs_ForeignKeyDescription         FROM admtf_ForeignKey_Features(a_SchemaName,a_ForeignKeyName);     IF FOUND AND v_ForeignKeyName IS NOT NULL THEN\t\t         RETURN QUERY SELECT v_FeatureCategory,COALESCE(a_ForeignKeyNo,v_FeatureNumber),                     v_ForeignKeyName,v_ForeignKeyDescription,                     NULL::NAME AS rfk_UserTypeName, NULL::NAME AS rfk_TypeName,                      NULL::BOOLEAN AS rfk_isNotNULL; \tEND IF;\t\t\t     v_FeatureCategory:=REPLACE(c_AttributeCategory,c_WildChar, v_ForeignKeyCharNo);     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,r_ForeignKeyNo,r_AttributeName,r_Description,                         r_UserTypeName,r_TypeName,r_isNotNULL              FROM  admtf_ForeignKey_Attributes(a_SchemaName,a_ForeignKeyName);     RETURN QUERY SELECT fkrt_FeatureCategory,fkrt_FeatureNumber,fkrt_FeatureName,                         fkrt_FeatureDescription,fkrt_UserTypeName,fkrt_TypeName,                          fkrt_isNotNULL AS rfk_isNotNULL             FROM  admtf_ForeignKey_ReferenceTableComplexFeatures(a_SchemaName,                             a_ForeignKeyName,a_ForeignKeyNo);\t\t\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ComplexFeatures(a_SchemaName NAME,a_ForeignKeyName NAME,a_ForeignKeyNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_ForeignKey_ComplexFeatures (a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256),a_ForeignKeyNo SMALLINT); \/**************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432   *\/ \/**************************************************************\/ CREATE OR REPLACE FUNCTION admtf_ForeignKey_ComplexFeatures     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_ForeignKeyName VARCHAR(256) default NULL, \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      a_ForeignKeyNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rfk_FeatureCategory VARCHAR(10),rfk_FeatureNumber SMALLINT,rfk_FeatureName VARCHAR(256),rfk_FeatureDescription TEXT, rfk_UserTypeName VARCHAR(256),rfk_TypeName VARCHAR(256),rfk_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%';  --********************************************************************\t\t BEGIN     RETURN QUERY SELECT fkcf.rfk_FeatureCategory::VARCHAR(10),                    fkcf.rfk_FeatureNumber::SMALLINT,                     fkcf.rfk_FeatureName::VARCHAR(256),fkcf.rfk_FeatureDescription::TEXT,                     fkcf.rfk_UserTypeName::VARCHAR(256),fkcf.rfk_TypeName::VARCHAR(256),                     fkcf.rfk_isNotNULL::BOOLEAN             FROM  admtf_ForeignKey_ComplexFeatures(a_SchemaName::NAME,                                     a_ForeignKeyName::NAME,a_ForeignKeyNo::SMALLINT) fkcf;\t\t\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_ForeignKey_ComplexFeatures(a_SchemaName VARCHAR(256),a_ForeignKeyName VARCHAR(256),a_ForeignKeyNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_ForeignKey_ComplexFeatures('public'::NAME,'fk_street_locality'::NAME); SELECt * FROM admtf_ForeignKey_ComplexFeatures('public'::NAME,'fk_street_locality'::NAME,1::SMALLINT); SELECt * FROM admtf_ForeignKey_ComplexFeatures('public'::VARCHAR,'fk_street_locality'::VARCHAR,3::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfIndexCF\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Index_ComplexFeatures<\/h3>\n<p>  <a href=\"#tfIndexCF_def\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c.<\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Index_Features<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_Features (a_SchemaName NAME,a_IndexName NAME); \/*******************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*   \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435                                                           *\/ \/*******************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_Features     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_IndexName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_IndexName NAME,rs_IndexDescription TEXT) AS $BODY$ DECLARE c_IndexKind CONSTANT CHAR:='i';  v_IndexOID OID; \/* \u0418\u0414 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ --***************************************************\t\t BEGIN\t\t     SELECT INTO rs_IndexName,rs_IndexDescription                          inxcls.relname,                         CASE WHEN COALESCE(TRIM(dsc.description),'')=''                              THEN '\u0418\u043d\u0434\u0435\u043a\u0441' || CASE WHEN inx.indisunique                                      THEN ' \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439' ||                                          CASE WHEN inx.indisprimary                                              THEN '(\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447)' ELSE '' END                                      ELSE '' END ||                              CASE WHEN inxam.amname='gist'                                      THEN ' \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439' ELSE '' END || \t\t\t\t\t' \u0442\u0430\u0431\u043b\u0438\u0446\u044b '||tbl.relname                             ELSE dsc.description END\t         FROM pg_index inx              INNER JOIN pg_class inxcls ON inx.indexrelid=inxcls.oid              INNER JOIN pg_namespace nsp ON inxcls.relnamespace=nsp.oid              LEFT OUTER JOIN pg_Description dsc ON inxcls.oid=dsc.objoid                             AND dsc.objsubid=0             LEFT OUTER JOIN pg_am inxam ON inxcls.relam=inxam.oid             LEFT OUTER JOIN pg_class tbl ON inx.indrelid=tbl.oid         WHERE nsp.nspname=LOWER(a_SchemaName)                              AND inxcls.relkind=c_IndexKind                             AND inxcls.relname =LOWER(a_IndexName); \tRETURN QUERY SELECT rs_IndexName,rs_IndexDescription;\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_Features(a_SchemaName NAME,a_IndexName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_Features (a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256)); \/*******************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*   \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435                                                           *\/ \/*******************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_Features     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_IndexName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_IndexName VARCHAR(256),rs_IndexDescription TEXT) AS $BODY$ DECLARE c_IndexKind CONSTANT CHAR:='i'; --***********************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT ixf.rs_IndexName::VARCHAR(256),                     ixf.rs_IndexDescription::TEXT         FROM admtf_Index_Features(a_SchemaName::NAME,a_IndexName::NAME) ixf; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_Features(a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_Index_Features('public'::NAME,'xie1street'::NAME); SELECt * FROM admtf_Index_Features('public'::VARCHAR(256),'xie1street'::VARCHAR(256)); SELECt * FROM admtf_Index_Features('public'::VARCHAR(256),'xie9street'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Index_Attributes<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_Attributes (a_SchemaName NAME,a_IndexName NAME); \/*******************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*   \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435                                                          *\/ \/*******************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_Attributes     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_IndexName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_IndexNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName NAME,r_OrderDirect VARCHAR(10), r_UserTypeName NAME,r_TypeName NAME,r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE cursor_IndexNoOfAttribute  refcursor;  \/* \u043d\u043e\u043c\u0435\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430*\/ c_IndexKind CONSTANT CHAR:='i'; v_IndexOID OID; \/* \u0418\u0414 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexName NAME;\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_MasterTableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 *\/ v_IndexArray SMALLINT[]; \/* \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043d\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/ v_IndexKeyOps SMALLINT[]; \/* \u041c\u0430\u0441\u0441\u0438\u0432 \u043e\u043f\u0446\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430*\/ v_AmCanOrder BOOLEAN; \/* \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 *\/                                        \/* \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 *\/                                    \/*\u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430?*\/ v_MasterTableOID\tOID;\t\t\/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 *\/ v_AttributeNumber\tSMALLINT;\t\/* \u041d\u043e\u043c\u0435\u0440 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/ v_AttributeOrderCode\tINTEGER;\t\t\/* \u041f\u0440\u0438\u0437\u043d\u0430\u043a \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430*\/ v_IndexAttributeCount\tINTEGER;\t\/* \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430*\/ v_AttNo\t\t\tSMALLINT;\t\/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430*\/ --*************************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT (inx.No+1)::SMALLINT AS r_IndexNo,                             attr.attnum::SMALLINT AS r_AttributeNumber,                              attr.attname::NAME AS r_AttributeName,                             CASE WHEN NOT inxam.amcanorder                                      THEN NULL                                      ELSE CASE WHEN inx.indoption[inx.No] &amp; 1=1                                                  THEN 'DESC'                                                  ELSE 'ASC' END                                      END::VARCHAR(10) AS r_OrderDirect,                             CASE WHEN COALESCE(typ.typbasetype,0)&gt;0                                      THEN typ.typname::NAME                                      ELSE ''END AS r_UserTypeName,                                 FORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),                                     COALESCE(NULLIF(typ.typtypmod,-1),                                                           attr.atttypmod))::NAME AS r_TypeName,\t\t\t\t \t\t\t\tattr.attnotnull AS r_isNotNULL,\t\t\t\t \t\t\t\tdsc.description AS r_Description          FROM (SELECT i.indrelid, i.indexrelid,i.indkey::SMALLINT[],                         i.indoption::SMALLINT[],                         generate_subscripts(i.indkey, 1) as No FROM pg_index i) inx              INNER JOIN pg_class inxcls ON inx.indexrelid=inxcls.oid              INNER JOIN pg_namespace nsp ON inxcls.relnamespace=nsp.oid              LEFT OUTER JOIN pg_am inxam ON inxcls.relam=inxam.oid             LEFT OUTER JOIN pg_class tbl ON inx.indrelid=tbl.oid             INNER JOIN pg_attribute attr ON attr.attrelid=tbl.oid                  AND attr.attnum=inx.indkey[inx.No]             LEFT OUTER JOIN pg_type typ ON attr.atttypid=typ.oid             LEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid             LEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid                 AND dsc.objsubid=attr.attnum         WHERE nsp.nspname=LOWER(a_SchemaName)                  AND inxcls.relkind=c_IndexKind                 AND inxcls.relname =LOWER(a_IndexName)         ORDER BY nsp.nspname,inxcls.relname,inx.No; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_Attributes(a_SchemaName NAME,a_IndexName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_Attributes (a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256)); \/*******************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0435                                                          *\/ \/******************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_Attributes     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_IndexName\t VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (r_IndexNo SMALLINT,r_AttributeNumber SMALLINT,r_AttributeName VARCHAR(256),r_OrderDirect VARCHAR(10),r_UserTypeName VARCHAR(256),r_TypeName VARCHAR(256),r_isNotNULL BOOLEAN,r_Description Text) AS $BODY$ DECLARE c_IndexKind CONSTANT CHAR:='i'; --*******************************************************************\t\t BEGIN\t\t     RETURN QUERY SELECT ia.r_IndexNo::SMALLINT,                         ia.r_AttributeNumber::SMALLINT,                         ia.r_AttributeName::VARCHAR(256),                         ia.r_OrderDirect::VARCHAR(10),                         ia.r_UserTypeName::VARCHAR(256),                         ia.r_TypeName::VARCHAR(256),                         ia.r_isNotNULL::BOOLEAN,                         ia.r_Description::TEXT             FROM admtf_Index_Attributes(a_SchemaName::NAME,a_IndexName::NAME) ia; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_Attributes(a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt * FROM admtf_Index_Attributes('public'::NAME,'xie1street'::NAME); SELECt * FROM admtf_Index_Attributes('public'::VARCHAR(256),'xie1street'::VARCHAR(256)); SELECt * FROM admtf_Index_Attributes('public'::VARCHAR(256),'xie9street'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_ComplexFeatures (a_SchemaName NAME,a_IndexName NAME,a_IndexNo SMALLINT); \/************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b,           *\/ \/*  \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 *\/ \/************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_ComplexFeatures     (a_SchemaName NAME default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/     a_IndexName NAME default NULL, \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/     a_IndexNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rix_FeatureCategory VARCHAR(10),rix_FeatureNumber SMALLINT,rix_FeatureName NAME,rix_OrderDirect VARCHAR(10), rix_FeatureDescription TEXT, rix_UserTypeName NAME,rix_TypeName NAME,rix_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%'; c_IndexCategory CONSTANT VARCHAR(10):='idx'||c_WildChar;\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                             \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_AttributeCategory CONSTANT VARCHAR(10):='idx'||c_WildChar||'att';\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                             \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexOID OID; \/* \u0418\u0414 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexCharNo VARCHAR(2); \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t v_IndexDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_FeatureCategory VARCHAR(10); \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 *\/ v_FeatureNumber SMALLINT; \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438*\/\t --***************************************************************************\t\t BEGIN\t     v_IndexCharNo:=COALESCE(TRIM(TO_CHAR(a_IndexNo,'09')),'');     v_FeatureCategory:=REPLACE(c_IndexCategory,c_WildChar, v_IndexCharNo);     v_FeatureNumber:=0;     SELECT INTO v_IndexName,v_IndexDescription  rs_IndexName,rs_IndexDescription         FROM admtf_Index_Features(a_SchemaName,a_IndexName);     IF FOUND AND v_IndexName IS NOT NULL THEN\t\t         RETURN QUERY SELECT v_FeatureCategory,                     COALESCE(a_IndexNo,v_FeatureNumber),                     v_IndexName,NULL::VARCHAR(10),                     v_IndexDescription,                     NULL::NAME AS rix_UserTypeName,                      NULL::NAME AS rix_TypeName,                      NULL::BOOLEAN AS rix_isNotNULL;     END IF;\t\t\t     v_FeatureCategory:=REPLACE(c_AttributeCategory,c_WildChar, v_IndexCharNo);     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,r_IndexNo,                     r_AttributeName,r_OrderDirect,r_Description,                     r_UserTypeName,r_TypeName,r_isNotNULL             FROM  admtf_Index_Attributes(a_SchemaName,a_IndexName);     RETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_ComplexFeatures(a_SchemaName NAME,a_IndexName NAME,a_IndexNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Index_ComplexFeatures (a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256),a_IndexNo SMALLINT); \/************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b,          *\/  \/* \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 *\/ \/************************************************************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Index_ComplexFeatures     (a_SchemaName VARCHAR(256) default 'public', \/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_IndexName VARCHAR(256) default NULL, \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/      a_IndexNo SMALLINT default NULL \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/\t )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rix_FeatureCategory VARCHAR(10),rix_FeatureNumber SMALLINT, rix_FeatureName VARCHAR(256),rix_OrderDirect VARCHAR(10),rix_FeatureDescription TEXT, rix_UserTypeName VARCHAR(256),rix_TypeName VARCHAR(256),rix_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_WildChar CONSTANT VARCHAR(1):='%'; --********************************************************************\t\t BEGIN\t     RETURN QUERY SELECT icf.rix_FeatureCategory::VARCHAR(10),                                     icf.rix_FeatureNumber::SMALLINT,                                     icf.rix_FeatureName::VARCHAR(256),                                     icf.rix_OrderDirect::VARCHAR(10),                                      icf.rix_FeatureDescription::TEXT,                                     icf.rix_UserTypeName::VARCHAR(256),                                     icf.rix_TypeName::VARCHAR(256),                                     icf.rix_isNotNULL::BOOLEAN         FROM  admtf_Index_ComplexFeatures(a_SchemaName::NAME,                             a_IndexName::NAME,a_IndexNo::SMALLINT) icf; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Index_ComplexFeatures(a_SchemaName VARCHAR(256),a_IndexName VARCHAR(256),a_IndexNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Index_ComplexFeatures('public'::NAME,'xie1street'::NAME,7::SMALLINT); SELECT * FROM admtf_Index_ComplexFeatures('public'::VARCHAR(256),'xie1street'::VARCHAR(256),7::SMALLINT); SELECT * FROM admtf_Index_ComplexFeatures('public'::VARCHAR(256),'xie9street'::VARCHAR(256),7::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfTableCF\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_ComplexFeatures<\/h3>\n<p>  <a href=\"#tfTableCF_def\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\u0445 <a href=\"https:\/\/habr.com\/post\/415575\/#tfPKCF_def\"> \u00ab\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00bb<\/a> \u0438 <a href=\"https:\/\/habr.com\/post\/415575\/#ExpFeatures\"> \u00ab\u041e \u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u0445 \u0438\u0434\u0435\u0442 \u0440\u0435\u0447\u044c?\u00bb<\/a>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u043a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_ComplexFeatures (a_SchemaName NAME,a_TableName NAME); \/*******************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, *\/ \/*   \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432\t                                                  *\/ \/********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_ComplexFeatures     (a_SchemaName NAME default 'public',\t\/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 *\/      a_TableName NAME default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rr_FeatureCategory VARCHAR(12),rr_FeatureNumber SMALLINT,rr_FeatureName NAME,rr_FeatureDescription TEXT,rr_UserTypeName NAME,rr_TypeName NAME,rr_isNotNULL BOOLEAN) AS $BODY$ DECLARE cursor_ForeignKeys refcursor;  \/* \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ cursor_Indexes refcursor; \/* \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ c_WildChar CONSTANT VARCHAR(1):='%';\t c_TableCategory CONSTANT VARCHAR(10):='tbl'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                             \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_SequenceCategory\tCONSTANT VARCHAR(10):='seq'||c_WildChar; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                            \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_InheritanceTableCategory CONSTANT VARCHAR(10):='inhtbl'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                              \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_AttributeCategory CONSTANT VARCHAR(10):='att'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                               \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_PrimaryKeyCategory CONSTANT VARCHAR(10):='pk'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                                \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_ForeignKeyCategory CONSTANT VARCHAR(10):='fk';\t\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                                 \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_IndexCategory CONSTANT VARCHAR(10):='idx'; \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                                 \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ c_PrimaryKeyKind CONSTANT CHAR:='p'; c_ForeignKeyKind CONSTANT CHAR:='f'; v_TableOID OID; \/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_TableName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_TableDescription TEXT; \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_FeatureCategory VARCHAR(12); \/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u0442\u0430 *\/ v_FeatureNumber SMALLINT; \/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438*\/\t v_PrimaryKeyName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_ForeignKeyName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_FKeyCount INTEGER; \/* \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ v_IndexName NAME; \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ v_IndexCount INTEGER; \/* \u0421\u0447\u0435\u0442\u0447\u0438\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ --*******************************************************************\t\t BEGIN\t     v_FeatureCategory:=c_TableCategory;     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,v_FeatureNumber,rs_TableName,                 rs_TableDescription,NULL::NAME AS rr_UserTypeName,                  NULL::NAME AS rr_TypeName,NULL::BOOLEAN AS rr_isNotNULL            FROM admtf_Table_Features(a_SchemaName,a_TableName);     v_FeatureCategory:=c_AttributeCategory;     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,r_AttributeNumber,r_AttributeName,r_Description,                         r_UserTypeName,r_TypeName,r_isNotNULL              FROM  admtf_Table_Attributes(a_SchemaName,a_TableName);     v_FeatureCategory:=c_SequenceCategory;     v_FeatureNumber:=0;     RETURN QUERY SELECT REPLACE(c_SequenceCategory,c_WildChar,                     COALESCE(TRIM(TO_CHAR(r_SequenceNumber,'09')),'')):: VARCHAR(12)                                                                          AS rr_FeatureCategory,                     r_SequenceNumber,r_SequenceName,r_SequenceDescription,                     NULL::NAME AS rr_UserTypeName, NULL::NAME AS rr_TypeName,                     NULL::BOOLEAN AS rr_isNotNULL                FROM  admtf_Table_Sequences(a_SchemaName,a_TableName);     v_FeatureCategory:=c_PrimaryKeyCategory;     v_FeatureNumber:=0;     SELECT INTO v_PrimaryKeyName r_ConstraintName          FROM admtf_Table_Constraintes(a_SchemaName,a_TableName)         WHERE r_ConstraintType=c_PrimaryKeyKind;     IF FOUND THEN\t         RETURN QUERY SELECT rpk_FeatureCategory ,rpk_FeatureNumber,                 rpk_FeatureName,rpk_FeatureDescription,rpk_UserTypeName,                 rpk_TypeName, rpk_isNotNULL              FROM admtf_PrimaryKey_ComplexFeatures(a_SchemaName,v_PrimaryKeyName);     END IF;     OPEN cursor_ForeignKeys  FOR SELECT r_ConstraintName          FROM admtf_Table_Constraintes(a_SchemaName,a_TableName)          WHERE r_ConstraintType=c_ForeignKeyKind          ORDER BY r_ConstraintName;     v_FeatureCategory:=c_ForeignKeyCategory;     v_FKeyCount:=0;     FETCH FIRST FROM cursor_ForeignKeys  INTO v_ForeignKeyName;     WHILE FOUND     LOOP         v_FKeyCount:=v_FKeyCount+1;         RETURN QUERY SELECT rfk_FeatureCategory ,                 CASE WHEN rfk_FeatureCategory  = c_ForeignKeyCategory                          THEN v_FKeyCount::SMALLINT ELSE  rfk_FeatureNumber END,                 rfk_FeatureName,rfk_FeatureDescription,                 rfk_UserTypeName,rfk_TypeName, rfk_isNotNULL              FROM admtf_ForeignKey_ComplexFeatures(a_SchemaName,                         v_ForeignKeyName,v_FKeyCount::SMALLINT);         FETCH NEXT  FROM cursor_ForeignKeys  INTO  v_ForeignKeyName;     END LOOP;     CLOSE cursor_ForeignKeys ;     OPEN cursor_Indexes  FOR SELECT r_IndexName          FROM admtf_Table_Indexes(a_SchemaName,a_TableName)          ORDER BY r_IndexName ;     v_FeatureCategory:=c_IndexCategory;     v_IndexCount:=0;     FETCH FIRST FROM cursor_Indexes  INTO v_IndexName;     WHILE FOUND     LOOP         v_IndexCount:=v_IndexCount+1;         RETURN QUERY SELECT rix_FeatureCategory ,                 CASE WHEN rix_FeatureCategory  = c_IndexCategory                          THEN v_IndexCount::SMALLINT ELSE  rix_FeatureNumber END,                 rix_FeatureName,rix_FeatureDescription,                 rix_UserTypeName,rix_TypeName, rix_isNotNULL              FROM admtf_Index_ComplexFeatures(a_SchemaName,v_IndexName,                                 v_IndexCount::SMALLINT);         FETCH NEXT  FROM cursor_Indexes  INTO  v_IndexName;     END LOOP;     CLOSE cursor_Indexes ;     v_FeatureCategory:=c_InheritanceTableCategory;     v_FeatureNumber:=0;     RETURN QUERY SELECT v_FeatureCategory,RANK()                      OVER(PARTITION BY v_FeatureCategory ORDER BY rs_TableName )::SMALLINT,             rs_TableName,rs_TableDescription,             NULL::NAME AS rr_UserTypeName, NULL::NAME AS rr_TypeName,             NULL::BOOLEAN rr_isNotNULL            FROM admtf_Table_InheritanceChildrens(a_SchemaName,a_TableName); END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_ComplexFeatures(a_SchemaName NAME,a_TableName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_ComplexFeatures (a_SchemaName VARCHAR(256),a_TableName VARCHAR(256)); \/********************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, *\/ \/*  \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432                                                   *\/ \/*******************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_ComplexFeatures     (a_SchemaName VARCHAR(256) default 'public',\/* \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445*\/      a_TableName VARCHAR(256) default NULL \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rr_FeatureCategory VARCHAR(12),rr_FeatureNumber SMALLINT,rr_FeatureName VARCHAR(256),rr_FeatureDescription TEXT,\trr_UserTypeName VARCHAR(256),rr_TypeName VARCHAR(256),rr_isNotNULL BOOLEAN) AS $BODY$ DECLARE c_TableCategory CONSTANT VARCHAR(10):='tbl';\t\/* \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f *\/                                                 \/* \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ --***********************************************************\t\t BEGIN\t     RETURN QUERY SELECT tcf.rr_FeatureCategory::VARCHAR(12),                             tcf.rr_FeatureNumber::SMALLINT,                             tcf.rr_FeatureName::VARCHAR(256),                             tcf.rr_FeatureDescription::TEXT,                             tcf.rr_UserTypeName::VARCHAR(256),                             tcf.rr_TypeName::VARCHAR(256),                             tcf.rr_isNotNULL::BOOLEAN       FROM admtf_Table_ComplexFeatures(a_SchemaName::NAME,a_TableName::NAME) tcf; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_ComplexFeatures(a_SchemaName VARCHAR(256),a_TableName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0435\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Table_ComplexFeatures('public'::NAME,'Street'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p><b>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/415575\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0430\u044f<\/a>;<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/415897\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u0430\u044f<\/a>;<\/b><br \/>  <b><a href=\"https:\/\/habr.com\/post\/418597\/\">\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 PostgreSQL. \u0427\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f<\/a>.<\/b><\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/419749\/\"> https:\/\/habr.com\/post\/419749\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/419749\/\" class=\"post__text post__text-html js-mediator-article\">\u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c\u0438: pg_class, pg_attribute, pg_constraints \u0438 \u0442.\u0434. <a href=\"https:\/\/habr.com\/post\/415575\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a>, <a href=\"https:\/\/habr.com\/post\/415897\/\">\u0432\u0442\u043e\u0440\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/post\/418597\/\">\u0442\u0440\u0435\u0442\u044c\u044f<\/a> \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u044b \u0440\u0430\u043d\u0435\u0435.  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zc\/rx\/ta\/zcrxta08dnfat5cqpgid4lyq7by.png\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c\u0438 \u0438\u0437 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 PostgrSQL, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0435\u043c\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0435\u0449\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u043c, \u0434\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0442\u0435\u0445, \u0447\u0442\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445. \u0422\u0430\u043a\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u044f\u043c\u043e \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288830","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288830"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288830\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}