{"id":287684,"date":"2018-08-16T14:14:39","date_gmt":"2018-08-16T10:14:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287684"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287684","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. \u0427\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418597\/\" class=\"post__text post__text-html js-mediator-article\">\u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\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. <\/p>\n<p>  <a href=\"https:\/\/habr.com\/post\/415575\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/post\/415897\/\">\u0432\u0442\u043e\u0440\u0430\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>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 <b>\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/b>, \u0430 \u0442\u0430\u043a\u0436\u0435 <b>\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446<\/b>. <br \/>  <a name=\"habracut\"><\/a><br \/>  \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>. <\/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\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i6\/dw\/f_\/i6dwf_jd0ofjr-vqmeide0l1vws.png\"><br \/>  <i>\u0420\u0438\u0441. 2. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 admtf_Table_Sequences \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/i><\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 11. \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/strong><\/p>\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\">admtf_Sequence_Features<\/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 \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<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\">admtf_Table_Sequences<\/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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\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<\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Sequence_Features<\/b> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <a name=\"tfSeqF_def\"><\/a><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_Sequence_Features \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\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (SEQUENCE) \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <a href=\"#tfSeqF\">\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>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Sequence_Features<\/b> \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\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (<b>SEQUENCE<\/b>) \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (<b>a_SequenceName<\/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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 (<b>a_SchemaName<\/b>).<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Sequence_Features<\/b> \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0435 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <b>SELECT<\/b>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0445 <b>pg_class<\/b>, <b>pg_namespace<\/b> \u0438 <b>pg_description<\/b>.<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">SELECT * FROM kr_road_network_vertices_pgr_id_seq; <\/code><\/pre>\n<p>  <\/p>\n<p><b><i>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 6<\/i><\/b><\/p>\n<p>  <\/p>\n<p>\u0412 10 \u0432\u0435\u0440\u0441\u0438\u0438 <b>PostgreSQL<\/b> \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0435\u043d \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <b>pg_sequence<\/b> \u0441 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<b>start_value<\/b>), \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 (<b>increment_by<\/b>) \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435(<b>max_value<\/b>) \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<b>last_value<\/b>) \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0432 \u00ab\u0442\u0430\u0431\u043b\u0438\u0446\u0435\u00bb \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/p>\n<p><strong>\u041a\u043e\u043d\u0435\u0446 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f.<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0434\u0443\u043c\u0430\u044e, \u043f\u0440\u043e\u0434\u0438\u043a\u0442\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (<b>last_value<\/b>), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u043e\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0432\u043e\u0439. <\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <b>pg_class<\/b> \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0438\u0434\u0430 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f (relkind=<font color=\"red\">&#8216;S&#8217;<\/font>).<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 SQL.<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">EXECUTE 'SELECT last_value,start_value,increment_by,max_value FROM '||                            LOWER(a_SchemaName)||'.'||LOWER(a_SequenceName)                INTO  v_SequenceLastValue,v_SequenceStartValue,                           v_SequenceIncrementBy,v_SequenceMaxValue ;\t <\/code><\/pre>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 12. \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_Sequence_Features(&#8216;public&#8217;,&#8217;kr_road_network_vertices_pgr_id_seq&#8217;).<\/strong><\/p>\n<table width=\"25\">\n<tr>\n<th width=\"5\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"5\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"10\">\u0422\u0435\u043a\u0443\u0449\u0435\u0435<\/th>\n<th width=\"5\">\u041d\u0430\u0447\u0430\u043b\u043e<\/th>\n<th width=\"5\">\u041f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435<\/th>\n<th width=\"10\">\u041a\u043e\u043d\u0435\u0446<\/th>\n<\/tr>\n<tr>\n<td width=\"15\">kr_road_network<br \/>  _vertices_pgr_id<br \/>  _seq<\/td>\n<td width=\"20\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e-\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/td>\n<td width=\"10\">138023<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"10\">9223372036854775807<\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_Table_Sequences \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\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<\/h3>\n<p>  <a name=\"tfTableS_def\"><\/a><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_Sequences<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 (<b>SEQUENCE<\/b>) \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u0435 \u043f\u043e\u043b\u0435\u0439, \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439.<a href=\"#tfTableS\">\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>, \u0430 <a href=\"#tfTableS_woc\">\u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0443\u0440\u0441\u043e\u0440<\/a>.<\/p>\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\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 (<\/p>\n<p>a_SchemaName<\/p>\n<p>).<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/io\/cc\/ib\/ioccibem_rgf_rjzsnmd5va1xt0.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 pseq.relname AS SequenceName,snsp.nspname AS SequenceSchemaName,        COALESCE(dsc.description,'\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f '                                  ||da.attname) AS SequenceDescription,        d.depType AS DependcyType,da.attname AS AttributeName    FROM pg_depend d        INNER JOIN pg_class    pseq ON  d.objid = pseq.oid       INNER JOIN pg_namespace snsp ON pseq.relnamespace=snsp.oid        LEFT OUTER JOIN pg_Description dsc ON pseq.oid=dsc.objoid                                          AND dsc.objsubid=0       INNER JOIN pg_class tbl ON  d.refobjid = tbl.oid       INNER JOIN pg_namespace nsp ON tbl.relnamespace=nsp.oid        INNER JOIN pg_attribute da ON  da.attrelid= d.refobjid                                  AND da.attnum= d.refobjsubid    WHERE LOWER(nsp.nspname)=LOWER(a_SchemaName)        AND LOWER(tbl.relname)=LOWER(a_TableOID)       AND tbl.relkind = 'r' AND pseq.relkind = 'S'    ORDER BY pseq.relname; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 <b>pg_class<\/b>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0439 \u0435\u0433\u043e \u043a\u0430\u043a \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435, \u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u0432\u044f\u0437\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <b>pg_depend<\/b>.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 13. \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<b>pg_depend<\/b>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/strong>  <\/p>\n<table width=\"25\">\n<tr>\n<th width=\"5\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"5\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"10\">objid<\/td>\n<td width=\"20\">OID \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 pg_class<\/td>\n<\/tr>\n<tr>\n<td width=\"10\">objsubid<\/td>\n<td width=\"20\">\u042d\u0442\u043e \u043f\u043e\u043b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u043e\u043b\u044c<\/td>\n<\/tr>\n<tr>\n<td width=\"10\">refobjid<\/td>\n<td width=\"20\">OID \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/td>\n<\/tr>\n<tr>\n<td width=\"10\">refobjsubid<\/td>\n<td width=\"20\">\u041d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 <b>pg_namespace<\/b> \u0438 <b>pg_description<\/b>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0445\u0435\u043c\u044b \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 <b>pg_attribute<\/b> \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e: <b>attrelid= refobjid AND attnum= refobjsubid<\/b>. (\u0412 \u044d\u0442\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0441\u043f\u0440\u0430\u0432\u0430 \u043e\u0442 \u0437\u043d\u0430\u043a\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_depend<\/b>).<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Sequence_Features<\/b>. \u0426\u0438\u043a\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 14. \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_Sequences (&#8216;public&#8217;,&#8217;kr_road_network_vertices_pgr&#8217;).<\/strong><\/p>\n<table width=\"25\">\n<tr>\n<th width=\"5\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"5\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<\/th>\n<th width=\"5\">\u041d\u0430\u0447\u0430\u043b\u043e<\/th>\n<th width=\"5\">\u041f\u0440\u0438- \u0440\u0430\u0449\u0435\u043d\u0438\u0435<\/th>\n<th width=\"10\">\u041a\u043e\u043d\u0435\u0446<\/th>\n<th width=\"10\">\u041f\u043e\u043b\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"15\">kr_road_network<br \/>  _vertices_pgr_id<br \/>  _seq<\/td>\n<td width=\"20\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c-\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f id<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"5\">1<\/td>\n<td width=\"10\">9223372036854775807<\/td>\n<td width=\"10\">id<\/td>\n<\/tr>\n<\/table>\n<p>  <a name=\"tfTableS_woc_def\"><\/a><\/p>\n<h4>\u0412\u0435\u0440\u0441\u0438\u044f \u0431\u0435\u0437 \u043a\u0443\u0440\u0441\u043e\u0440\u0430<\/h4>\n<p>  <\/p>\n<p>\u0412 \u0441\u0440\u0435\u0434\u0435 <b>PostgreSQL<\/b>, \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u043d\u044c\u0448\u0435 10, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>admtf_Table_Sequences<\/b> \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0443\u0440\u0441\u043e\u0440\u0430, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. <br \/>  \u041d\u043e \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u0435\u043b\u0438 10 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u043a\u0443\u0440\u0441\u043e\u0440\u0430, \u0442.\u043a. \u0432 \u0438\u0445 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <b>pg_sequence<\/b>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043e\u0434\u043d\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <b>SELECT<\/b>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>RANK() OVER (PARTITION BY pseq.relname)<\/b> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1z\/qa\/r7\/1zqar7uba-68o2ya1l_o37ph5jc.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 pseq.relname) AS SequenceNo,         pseq.relname AS SequenceName,snsp.nspname AS SequenceSchemaName,         COALESCE(dsc.description,'\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f '                                   ||da.attname) AS SequenceDescription,         seq.seqstart AS SequenceStartValue,seq.seqincrement AS SequenceIncrementBy,         seq.seqmax AS SequenceMaxValue,         d.depType AS DependcyType,da.attname AS AttributeName     FROM pg_depend d         INNER JOIN pg_class    pseq ON  d.objid = pseq.oid        INNER JOIN pg_sequence  seq ON seq.seqrelid= pseq.oid        INNER JOIN pg_namespace snsp ON pseq.relnamespace=snsp.oid         LEFT OUTER JOIN pg_Description dsc ON pseq.oid=dsc.objoid                                             AND dsc.objsubid=0        INNER JOIN pg_class tbl ON  d.refobjid = tbl.oid        INNER JOIN pg_namespace nsp ON tbl.relnamespace=nsp.oid         INNER JOIN pg_attribute da ON  da.attrelid= d.refobjid                                    AND da.attnum= d.refobjsubid     WHERE LOWER(nsp.nspname)=LOWER(a_SchemaName)         AND LOWER(tbl.relname)=LOWER(a_TableOID)        AND tbl.relkind = 'r' AND pseq.relkind = 'S' ORDER BY pseq.relname; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p><strong>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 7<\/strong><\/p>\n<p>.  <\/p>\n<p>\u042d\u0442\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<b>last_value<\/b>).<\/p>\n<\/p>\n<p><strong>\u041a\u043e\u043d\u0435\u0446 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f.<\/strong><\/p>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f admtf_Table_InheritanceChildrens \u2013 \u0441\u043f\u0438\u0441\u043e\u043a \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 <\/h3>\n<p>  <a name=\"tfTableIC_def\"><\/a><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_InheritanceChildrens<\/b> \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 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 (<b>INHERITS<\/b>) \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. <a href=\"#tfTableIC\">\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>\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>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 <b>pg_class<\/b>. \u041d\u043e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <b>pg_depend<\/b>.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 15. \u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<b>pg_depend<\/b>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/strong>  <\/p>\n<table width=\"25\">\n<tr>\n<th width=\"5\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/th>\n<th width=\"5\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td width=\"10\">objid<\/td>\n<td width=\"20\">OID \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 pg_class<\/td>\n<\/tr>\n<tr>\n<td width=\"10\">refobjid<\/td>\n<td width=\"20\">OID \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<\/tr>\n<\/table>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pa\/ew\/kl\/paewklf4g7qvftdb99sss0efwqc.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 rtbl.relname,rnspc.nspname,rdsc.description,rtbl.relnatts::INTEGER,        rtbl.relchecks::INTEGER,        rtbl.relhaspkey,rtbl.relhasindex,rtbl.relhassubclass,        rtbl.reltuples::INTEGER    FROM pg_class tbl        INNER JOIN pg_namespace nspc ON tbl.relnamespace = nspc.oid        LEFT OUTER JOIN pg_Description dsc ON tbl.oid=dsc.objoid                                           AND dsc.objsubid=0       INNER JOIN pg_depend dp ON tbl.oid=dp.refobjid       INNER JOIN pg_class rtbl ON rtbl.OID=dp.objid       INNER JOIN pg_namespace rnspc ON rtbl.relnamespace = rnspc.oid        LEFT OUTER JOIN pg_Description rdsc ON rtbl.oid=rdsc.objoid                                            AND rdsc.objsubid=0    WHERE LOWER(nspc.nspname)=LOWER(a_SchemaName)       AND LOWER(tbl.relname)=LOWER(a_TableOID)       AND tbl.relkind = 'r' AND rtbl.relkind = 'r'    ORDER BY rtbl.relname; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 <b>pg_namespace<\/b> \u0438 <b>pg_description<\/b>, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0445\u0435\u043c\u044b \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a\u0430\u043a \u043a \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0442\u0430\u043a \u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 16. \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_InheritanceChildrens (&#8216;public&#8217;,&#8217;np_house&#8217;).<\/strong><\/p>\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"10\">\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=\"5\">\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b <\/th>\n<th width=\"5\">? \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447<\/th>\n<th width=\"5\">? \u0438\u043d\u0434\u0435\u043a\u0441\u044b<\/th>\n<th width=\"5\">? \u043f\u043e\u0442\u043e\u043c\u043a\u0438<\/th>\n<th width=\"5\">\u0427\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439<\/th>\n<\/tr>\n<tr>\n<td width=\"10\">np_house 04201 000000<\/td>\n<td width=\"20\">\u0414\u043e\u043c\u0430 \u0432 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 (\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440\u0430\u0439\u043e\u043d)<\/td>\n<td width=\"5\">15<\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">5651<\/td>\n<\/tr>\n<tr>\n<td width=\"10\">np_house 4208 000000<\/td>\n<td width=\"20\">\u0414\u043e\u043c\u0430 \u0432 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 (\u0411\u043e\u0433\u043e\u0442\u043e\u043b\u044c\u0441\u043a\u0438\u0439 \u0440\u0430\u0439\u043e\u043d)<\/td>\n<td width=\"5\">15<\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">f <\/td>\n<td width=\"5\">4314<\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 reltuple \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_class<\/b>. \u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0432\u0441\u0435 \u0436\u0435 \u044d\u0442\u043e \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">EXECUTE 'SELECT COUNT(*) FROM '||LOWER(a_SchemaName)||'.'||LOWER(a_TableName)              INTO  v_TableNumberOfRowCalc; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Table_InheritanceChildrens<\/b> \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u0440\u0441\u043e\u0440.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u0435, \u0442\u0430\u043a \u0438 \u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \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 \u2013 \u0440\u0435\u0436\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_Mode<\/b>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u00ab\u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u00bb (<font color=\"red\">estimate<\/font>) \u0438\u043b\u0438 \u00ab\u0442\u043e\u0447\u043d\u043e\u00bb (<font color=\"red\">exactly<\/font>). <\/p>\n<p>  <a name=\"fnTableRC_def\"><\/a>  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"#fnTableRC\">admfn_Table_RowCount<\/a>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <b>SELECT<\/b> \u0430\u0442\u0440\u0438\u0431\u0443\u0442 reltuple \u0437\u0430\u043c\u0435\u043d\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3f\/t_\/xf\/3ft_xftbnboqxguantdpivkdtva.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\">CASE WHEN a_Mode = 'exactly' THEN admfn_Table_RowCount(rnspc.nspname,rtbl.relname)                               ELSE reltuples END  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u00ab\u0447\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b\u00bb, \u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <b>a_Mode<\/b> \u043d\u0435 \u0437\u0430\u0434\u0430\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/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 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hi\/du\/at\/hiduatp-_vtmifufs_u53_roz2q.png\"><br \/>  <i>\u0420\u0438\u0441. 3. \u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 admtf_Attribute_Features<\/i><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ip\/3e\/rx\/ip3erx3a2sj9_kkoeriysoppfom.png\">  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0442\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\"><strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 17. \u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/strong><\/p>\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\">admtf_Attribute_PKFeatures<\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 (PRIMARY KEY), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\">admtf_Attribute_FKFeatures<\/td>\n<td width=\"40\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435 \u043a\u043b\u044e\u0447\u0435 (FOREIGN KEY), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">3<\/td>\n<td width=\"10\">admtf_Attribute_Features<\/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 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/td>\n<\/tr>\n<\/table>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Attribute_PKFeatures<\/b> \u2014  \u2014 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435<\/h3>\n<p>  <a name=\"tfAttPK_def\"><\/a>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Attribute_PKFeatures<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 (PRIMARY KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0438, \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043a\u0430\u043a\u043e\u0432 \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u044e\u0447\u0435, \u0442.\u043a. \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c. <br \/>  <a href=\"#tfAttPK\">\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>\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 OID \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_TableOID<\/b>) \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u043d\u0435\u0439 (<b>a_AttributeNo<\/b>).<\/p>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_constraint<\/b>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (CONSTRAINT) \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430. OID \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <b>conrelid<\/b>, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0437\u0430\u043f\u0438\u0441\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u0435 contype \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <font color=\"red\">&#187;p&#8217;<\/font><\/p>\n<p>.  <\/p>\n<pre><code class=\"sql\">SELECT INTO v_PKAttributeList,rs_isAttributePK conkey,ARRAY[a_AttributeNo]&lt;@conkey        FROM pg_constraint c      WHERE c.contype='p' AND c.conrelid=a_TableOID; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435 <b>conkey<\/b>, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <b>ARRAY[a_AttributeNo]&lt;@conkey<\/b>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435, \u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Attribute_FKFeatures<\/b> -\u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435<\/h3>\n<p>  <a name=\"tfAttFK_def\"><\/a>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Attribute_FKFeatures<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u0445 (FOREIGN KEY) \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0438, \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043a\u0430\u043a\u043e\u0432\u044b \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432 \u044d\u0442\u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u0445, \u0442.\u043a. \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u043c. <\/p>\n<p>  <a href=\"#tfAttFK\">\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>\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 OID \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_TableOID<\/b>) \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u043d\u0435\u0439 (<b>a_AttributeNo<\/b>).<\/p>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_constraint<\/b>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (CONSTRAINT) \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439. OID \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <b>conrelid<\/b>, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0437\u0430\u043f\u0438\u0441\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u0435 contype \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <font color=\"red\">&#187;f&#8217;<\/font><\/p>\n<p>.  <\/p>\n<pre><code class=\"sql\">SELECT * FROM pg_constraint c      WHERE c.contype='f ' AND c.conrelid=a_TableOID AND ARRAY[a_AttributeNo]&lt;@conkey      ORDER BY c.oid; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435 <b>conkey<\/b>, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <b>ARRAY[a_AttributeNo]&lt;@conkey<\/b>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435, \u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0435\u0433\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u0445. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u0437 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0435\u0433\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u0445.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_class<\/b> \u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 (OID) \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u0437 \u043f\u043e\u043b\u044f confrelid \u0437\u0430\u043f\u0438\u0441\u0438 \u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u043f\u043e\u043b\u044f <\/p>\n<p>confkey<\/p>\n<p> (\u043e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u043a\u0432\u043e\u0439 \u00ab<b>f<\/b>\u00bb \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438). \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u043f\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\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u043e\u043c\u0443 \u043d\u043e\u043c\u0435\u0440\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0435\u0435 OID, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 pg_attribute \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435.   <\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <b>admtf_Attribute_Features<\/b> \u2014 \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\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>  <a name=\"tfAttF_def\"><\/a><\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Attribute_Features<\/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 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<a href=\"#tfAttF\">\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>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tu\/bz\/me\/tubzmeucr-nzriafiuufgbv31ew.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=\"10\">\u0422\u0438\u043f<\/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\">AttributeName<\/td>\n<td width=\"10\">name<\/td>\n<td width=\"40\">\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430.<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">2<\/td>\n<td width=\"10\">UserTypeName<\/td>\n<td width=\"10\">VARCHAR(256)<\/td>\n<td width=\"40\">\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0442\u0438\u043f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">3<\/td>\n<td width=\"10\">TypeName<\/td>\n<td width=\"10\">VARCHAR(256)<\/td>\n<td width=\"40\">\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">4<\/td>\n<td width=\"10\">isNotNULL<\/td>\n<td width=\"10\">BOOLEAN<\/td>\n<td width=\"40\">? \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f NULL<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">5<\/td>\n<td width=\"10\">isAttributePK<\/td>\n<td width=\"10\">BOOLEAN<\/td>\n<td width=\"40\">? \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 PK<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">6<\/td>\n<td width=\"10\">ColumnPKNo<\/td>\n<td width=\"10\">SMALLINT<\/td>\n<td width=\"40\">\u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 PK<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">7<\/td>\n<td width=\"10\">Description<\/td>\n<td width=\"10\">TEXT<\/td>\n<td width=\"40\">\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">8<\/td>\n<td width=\"10\">isAttributeFK<\/td>\n<td width=\"10\">BOOLEAN<\/td>\n<td width=\"40\">? \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 FK<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">9<\/td>\n<td width=\"10\">FKeyName<\/td>\n<td width=\"10\">name[]<\/td>\n<td width=\"40\">\u041c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">10<\/td>\n<td width=\"10\">ColumnFKNo<\/td>\n<td width=\"10\">SMALLINT[]<\/td>\n<td width=\"40\">\u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043a\u043b\u044e\u0447\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">11<\/td>\n<td width=\"10\">FKTableName<\/td>\n<td width=\"10\">name[]<\/td>\n<td width=\"40\">\u041c\u0430\u0441\u0441\u0438\u0432 \u0442\u0430\u0431\u043b\u0438\u0446, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0438<\/td>\n<\/tr>\n<tr>\n<td width=\"5\">12<\/td>\n<td width=\"10\">FKTableColumnName<\/td>\n<td width=\"10\">name[]<\/td>\n<td width=\"40\">\u041c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443<\/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 OID \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (<b>a_TableOID<\/b>) \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u043d\u0435\u0439 (<b>a_AttributeNo<\/b>).<br \/>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 <b>AttributeName<\/b> \u0438 <b>isNotNULL<\/b> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <b>pg_attribute<\/b>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">SELECT attr.attname, attr.attnotnull FROM pg_attribute attr      WHERE attr.attrelid =a_TableOID AND attr.attnum=a_AttributeNo; SELECT rs_isAttributePK,rs_ColumnPKNo      FROM admtf_Attribute_PKFeatures (a_TableOID,a_AttributeNo); SELECT rs_isAttributeFK,rs_FKeyName,rs_ColumnFKNo,        rs_FKTableName,rs_FKTableColumnName      FROM admtf_Attribute_FKFeatures (a_TableOID,a_AttributeNo); <\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 <b>isAttributePK<\/b> \u0438 <b>ColumnPKNo<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b>admtf_Attribute_PKFeatures<\/b>.<\/p>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 <b>isAttributeFK<\/b>, <b>FKeyName<\/b>, <b>ColumnFKNo<\/b>, <b>FKTableName<\/b>, <b>FKTableColumnName<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <b>admtf_Attribute_FKFeatures<\/b>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>admtf_Attribute_Features((SELECT OID FROM pg_class WHERE relname=&#8217;street&#8217;),2::SMALLINT)<\/b> \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 18. \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_Attribute_Features<\/strong>  <\/p>\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"10\">AttributeName<\/th>\n<th width=\"10\">UserTypeName<\/th>\n<th width=\"10\">TypeName<\/th>\n<th width=\"10\">isNotNULL<\/th>\n<th width=\"10\">isAttributePK<\/th>\n<th width=\"10\">ColumnPKNo<\/th>\n<\/tr>\n<tr>\n<td width=\"10\">localityid<\/td>\n<td width=\"10\">localityid<\/td>\n<td width=\"10\">integer<\/td>\n<td>integer<\/td>\n<td>integer<\/td>\n<td width=\"2\">integer<\/td>\n<\/tr>\n<\/table>\n<table width=\"95\" border=\"1\">\n<tr>\n<th width=\"10\">Description<\/th>\n<th width=\"10\">isAttributeFK<\/th>\n<th width=\"10\">FKeyName<\/th>\n<th width=\"10\">ColumnFKNo<\/th>\n<th width=\"10\">FKTableName<\/th>\n<th width=\"10\">FKTableColumnName<\/th>\n<\/tr>\n<tr>\n<td width=\"10\">\u0418\u0414 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043d\u043a\u0442\u0430<\/td>\n<td width=\"10\">t<\/td>\n<td width=\"10\">{fk_street_locality}<\/td>\n<td>{2}<\/td>\n<td>{locality}<\/td>\n<td width=\"2\">{localityid}<\/td>\n<\/tr>\n<\/table>\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=\"tfSeqF\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Sequence_Features<\/h3>\n<p>  <a href=\"#tfTableS_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Sequence_Features (a_SchemaName NAME,a_SequenceName 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\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 *\/ \/****************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Sequence_Features \t(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*\/ \ta_SequenceName\tNAME default NULL\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/  )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rs_SequenceName NAME,rs_SequenceDescription TEXT,rs_NumberOfAttribute INTEGER,rs_SequenceLastValue BIGINT, \t\trs_SequenceStartValue BIGINT,rs_SequenceIncrementBy BIGINT,rs_SequenceMaxValue BIGINT) AS $BODY$ DECLARE \tc_SequenceKind\tCONSTANT CHAR:='S'; \tv_SequenceOID\t\tOID;\t\t\/* \u0418\u0414 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceName\t\tNAME;\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceDescription\tTEXT;\t\t\/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceStartValue\tBIGINT;\t\t\/* \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceIncrementBy\tBIGINT;\t\t\/* \u041f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceMaxValue\tBIGINT;\t\t\/* \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceLastValue\tBIGINT;\t\t\/* \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceNumberOfRowCalc\tINTEGER;\t\t\/* \u0427\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/  \t--************************************************************************\t\t BEGIN\t\t \tSELECT INTO rs_SequenceName,rs_SequenceDescription,rs_NumberOfAttribute \t\ttbl.relname, \t\tCOALESCE(dsc.description,'\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c') AS r_SequenceDescription, \t\ttbl.relnatts::INTEGER,tbl.relchecks::INTEGER,tbl.relhaspkey, \t\ttbl.relhasindex,tbl.relhassubclass,tbl.reltuples::INTEGER   \tFROM pg_class tbl  \t\tINNER JOIN pg_namespace nspc ON tbl.relnamespace = nspc.oid  \t\tLEFT OUTER JOIN pg_Description dsc ON tbl.oid=dsc.objoid \t\t\t\t\t\t\tAND dsc.objsubid=0 \tWHERE nspc.nspname=LOWER(a_SchemaName)  \t\tAND tbl.relkind=c_SequenceKind \t\tAND tbl.relname =LOWER(a_SequenceName); \tIF FOUND THEN\t\t \t\tEXECUTE 'SELECT last_value,start_value,increment_by,max_value  \t\t\t\tFROM '||LOWER(a_SchemaName)||'.'||LOWER(a_SequenceName)  INTO \t\t\t\t\tv_SequenceLastValue,v_SequenceStartValue, \t\t\t\t\tv_SequenceIncrementBy,v_SequenceMaxValue ;\t\t\t\t \t\tRETURN QUERY SELECT rs_SequenceName,rs_SequenceDescription, \t\t\t\t\trs_NumberOfAttribute,v_SequenceLastValue, \t\t\t\t\tv_SequenceStartValue,v_SequenceIncrementBy, \t\t\t\t\tv_SequenceMaxValue;\t \t\tEND IF;\t \tRETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Sequence_Features(a_SchemaName NAME,a_SequenceName 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 \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, \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_Sequence_Features (a_SchemaName VARCHAR(256),a_SequenceName 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\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 *\/ \/****************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Sequence_Features \t(a_SchemaName\tVARCHAR(256) 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*\/ \ta_SequenceName\tVARCHAR(256) default NULL\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_SequenceName VARCHAR(256),rs_SequenceDescription TEXT, rs_NumberOfAttribute INTEGER,rs_SequenceLastValue BIGINT, rs_SequenceStartValue BIGINT,rs_SequenceIncrementBy BIGINT, rs_SequenceMaxValue BIGINT) AS $BODY$ DECLARE \tc_SequenceKind\tCONSTANT CHAR:='S'; --********************************************************\t\t BEGIN\t\t \tRETURN QUERY SELECT sf.rs_SequenceName::VARCHAR(256), \t\t\t\tsf.rs_SequenceDescription::TEXT, \t\t\t\tsf.rs_NumberOfAttribute::INTEGER, \t\t\t\tsf.rs_SequenceLastValue::BIGINT, \t\t\t\tsf.rs_SequenceStartValue::BIGINT, \t\t\t\tsf.rs_SequenceIncrementBy::BIGINT, \t\t\t\tsf.rs_SequenceMaxValue::BIGINT \tFROM admtf_Sequence_Features(a_SchemaName::NAME,a_SequenceName::NAME) sf;\t\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Sequence_Features(a_SchemaName VARCHAR(256),a_SequenceName 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 \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, \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_Sequence_Features('public'::VARCHAR(255),'k_dorogi_dijkstra_seq_seq'::VARCHAR(255)); SELECT * FROM admtf_Sequence_Features('public'::NAME,'kr_road_network_vertices_pgr_id_seq'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfTableS\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_Sequences<\/h3>\n<p>  <a href=\"#tfTableS_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_Sequences (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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 *\/ \/*********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_Sequences \t(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*\/ \ta_TableName\tNAME default NULL\t\/* \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 (r_SequenceNumber SMALLINT,r_SequenceName NAME, r_SequenceSchemaName NAME,r_SequenceDescription TEXT, r_SequenceStartValue BIGINT,r_SequenceIncrementBy BIGINT, r_SequenceMaxValue BIGINT,r_DependType NAME, r_RefTableName NAME,r_RefTableSchemaName NAME, r_RefAttributeName NAME) AS $BODY$ DECLARE \tv_TableOID                    INTEGER;\/* OID \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ \tv_Sequence                    RECORD;\/* \u0417\u0430\u043f\u0438\u0441\u044c \u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438*\/ \tv_SequenceOID               INTEGER;\/* OID \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f*\/ \tv_SequenceName             NAME;    \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceSchemaName   NAME;   \/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceDescription      TEXT;\t   \/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceStartValue\t       BIGINT;  \/* \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceIncrementBy\tBIGINT; \/* \u041f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceMaxValue\t       BIGINT;  \/* \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_DependcyType\t\tNAME; \/* \u0411\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 *\/                                                           \/* \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_AttributeName\t\tNAME;\t\/* \u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430*\/ \tv_SequenceNumber \tSMALLINT;\t\/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438*\/\t \tc_Delimiter\t\tCONSTANT VARCHAR(2):=','; \t--*********************************************************************\t\t BEGIN \tv_SequenceNumber:=0; \tFOR v_Sequence IN SELECT pseq.relname AS SequenceName, \t\t\t\t\tsnsp.nspname AS SequenceSchemaName, \t\t\t\t\tCOALESCE(dsc.description,'\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f  \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f '||da.attname) AS SequenceDescription, \t\t\t\t\td.depType AS DependcyType,da.attname AS AttributeName \t\t\tFROM pg_depend d  \t\t\t\tINNER JOIN pg_class    pseq ON  d.objid = pseq.oid \t\t\t\tINNER JOIN pg_namespace snsp ON pseq.relnamespace=snsp.oid  \t\t\t\tLEFT OUTER JOIN pg_Description dsc ON pseq.oid=dsc.objoid \t\t\t\t\t\t\t\tAND dsc.objsubid=0 \t\t\t\tINNER JOIN pg_class tbl ON  d.refobjid = tbl.oid \t\t\t\tINNER JOIN pg_namespace nsp ON tbl.relnamespace=nsp.oid  \t\t\t\tINNER JOIN pg_attribute da ON  da.attrelid= d.refobjid \t\t\t\t\tAND d.refobjsubid=da.attnum \t\t\tWHERE tbl.relkind = 'r' AND pseq.relkind = 'S'  \t\t\t\tAND LOWER(nsp.nspname)=LOWER(a_SchemaName) \t\t\t\t AND LOWER(tbl.relname)=LOWER(a_TableName) \t\t\tORDER BY pseq.relname \tLOOP \t\tv_SequenceNumber:=v_SequenceNumber+1; \t\tv_SequenceName:=v_Sequence.SequenceName; \t\tv_SequenceSchemaName:=v_Sequence.SequenceSchemaName; \t\tv_DependcyType:=v_Sequence.DependcyType; \t\tv_AttributeName:=v_Sequence.AttributeName; \t\tv_SequenceDescription:=v_Sequence.SequenceDescription; \t\tSELECT INTO v_SequenceStartValue,v_SequenceIncrementBy, \t\t\tv_SequenceMaxValue \t\t\trs_SequenceStartValue,rs_SequenceIncrementBy, \t\t\trs_SequenceMaxValue \t\tFROM admtf_Sequence_Features(v_SequenceSchemaName,v_SequenceName); \t\tRETURN QUERY SELECT v_SequenceNumber,v_SequenceName, \t\t\tv_SequenceSchemaName,v_SequenceDescription, \t\t\tv_SequenceStartValue,v_SequenceIncrementBy, \t\t\tv_SequenceMaxValue,v_DependcyType, \t\t\ta_TableName,a_SchemaName,v_AttributeName;\t\t\t\t\t \tEND LOOP;\t\t\t \tRETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_Sequences(a_SchemaName NAME, a_TableName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_Sequences (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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430  *\/ \/**********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_Sequences \t(a_SchemaName\tVARCHAR(256) 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*\/ \ta_TableName\tVARCHAR(256) default NULL\t\/* \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 (r_SequenceNumber SMALLINT,r_SequenceName VARCHAR(256), r_SequenceSchemaName VARCHAR(256),r_SequenceDescription TEXT, r_SequenceStartValue BIGINT,r_SequenceIncrementBy BIGINT, r_SequenceMaxValue BIGINT,r_DependType VARCHAR(256), r_RefTableName VARCHAR(256),r_RefTableSchemaName VARCHAR(256), r_RefAttributeName VARCHAR(256)) AS $BODY$ DECLARE \tc_Delimiter\t\tCONSTANT VARCHAR(2):=','; --******************************************************\t\t BEGIN\t\t \tRETURN QUERY SELECT ts.r_SequenceNumber::SMALLINT, \t\t\t\tts.r_SequenceName::VARCHAR(256), \t\t\t\tts.r_SequenceSchemaName::VARCHAR(256)\t, \t\t\t\tts.r_SequenceDescription::TEXT, \t\t\t\tts.r_SequenceStartValue::BIGINT, \t\t\t\tts.r_SequenceIncrementBy::BIGINT, \t\t\t\tts.r_SequenceMaxValue::BIGINT, \t\t\t\tts.r_DependType::VARCHAR(256), \t\t\t\tts.r_RefTableName::VARCHAR(256), \t\t\t\tts.r_RefTableSchemaName::VARCHAR(256), \t\t\t\tts.r_RefAttributeName::VARCHAR(256) \t\tFROM admtf_Table_Sequences(a_SchemaName::NAME,a_TableName::NAME) ts; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_Sequences(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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Table_Sequences('public'::VARCHAR(255),'kr_road_network_vertices_pgr'::VARCHAR(255)); SELECT * FROM admtf_Table_Sequences('public'::NAME,'kr_road_network_vertices_pgr'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfTableS_woc\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_Sequences \u0431\u0435\u0437 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 (PostgreSQL 10)<\/h3>\n<p>  <a href=\"#tfTableS_woc_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_Sequences (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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 *\/ \/**********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_Sequences \t(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*\/ \ta_TableName\tNAME default NULL\t\/* \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 (r_SequenceNumber SMALLINT,r_SequenceName NAME, \t\t\tr_SequenceSchemaName NAME,r_SequenceDescription TEXT, \t\t\tr_SequenceStartValue BIGINT,r_SequenceIncrementBy BIGINT, \t\t\tr_SequenceMaxValue BIGINT,r_DependType NAME, \t\t\tr_RefTableName NAME,r_RefTableSchemaName NAME, \t\t\tr_RefAttributeName NAME) AS $BODY$ DECLARE \tv_TableOID\t\tINTEGER;\t\t\/* OID \u0442\u0430\u0431\u043b\u0438\u0446\u044b*\/ \tv_Sequence \t\tRECORD;\t\t\t\/* \u0417\u0430\u043f\u0438\u0441\u044c \u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438*\/ \tv_SequenceOID\t\tINTEGER;\t\t\/* OID \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f*\/ \tv_SequenceName\t\tNAME;\t\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceSchemaName\tNAME;\t\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceDescription\tTEXT;\t\t\/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceStartValue\tBIGINT;\t\t\/* \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceIncrementBy\tBIGINT;\t\t\/* \u041f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_SequenceMaxValue\tBIGINT;\t\t\/* \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_DependcyType\t\tNAME;\t\t\/* \u0411\u0443\u043a\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 *\/ \tv_AttributeName\t\tNAME;\t\t\/* \u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430*\/ \tv_SequenceNumber \tSMALLINT;\t\/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438*\/\t \tc_Delimiter\t\tCONSTANT VARCHAR(2):=','; --******************************************************************\t\t BEGIN \tv_SequenceNumber:=0; \tFOR v_Sequence IN SELECT pseq.relname AS SequenceName, \t\t\t\t\tsnsp.nspname AS SequenceSchemaName, \t\t\t\t\tCOALESCE(dsc.description,'\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \t\t\t\t\t\t \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f '||da.attname) AS SequenceDescription, \t\t\t\t\td.depType AS DependcyType,da.attname AS AttributeName \t\tFROM pg_depend d  \t\t\tINNER JOIN pg_class    pseq ON  d.objid = pseq.oid \t\t\tINNER JOIN pg_namespace snsp ON pseq.relnamespace=snsp.oid  \t\t\tLEFT OUTER JOIN pg_Description dsc ON pseq.oid=dsc.objoid \t\t\t\t\tAND dsc.objsubid=0 \t\t\tINNER JOIN pg_class tbl ON  d.refobjid = tbl.oid \t\t\tINNER JOIN pg_namespace nsp ON tbl.relnamespace=nsp.oid  \t\t\tINNER JOIN pg_attribute da ON  da.attrelid= d.refobjid \t\t\t\t\tND d.refobjsubid=da.attnum \t\tWHERE tbl.relkind = 'r' AND pseq.relkind = 'S'  \t\t\tAND LOWER(nsp.nspname)=LOWER(a_SchemaName)  \t\t\tAND LOWER(tbl.relname)=LOWER(a_TableName) \t\tORDER BY pseq.relname \tLOOP \t\tv_SequenceNumber:=v_SequenceNumber+1; \t\tv_SequenceName:=v_Sequence.SequenceName; \t\tv_SequenceSchemaName:=v_Sequence.SequenceSchemaName; \t\tv_DependcyType:=v_Sequence.DependcyType; \t\tv_AttributeName:=v_Sequence.AttributeName; \t\tv_SequenceDescription:=v_Sequence.SequenceDescription; \t\tSELECT INTO v_SequenceStartValue,v_SequenceIncrementBy,v_SequenceMaxValue \t\t\trs_SequenceStartValue,rs_SequenceIncrementBy,rs_SequenceMaxValue \t\t\tFROM admtf_Sequence_Features(v_SequenceSchemaName,v_SequenceName); \t\tRETURN QUERY SELECT v_SequenceNumber,v_SequenceName, \t\t\t\tv_SequenceSchemaName,v_SequenceDescription, \t\t\t\tv_SequenceStartValue,v_SequenceIncrementBy, \t\t\t\tv_SequenceMaxValue,v_DependcyType, \t\t\t\ta_TableName,a_SchemaName,v_AttributeName;\t\t\t\t\t \tEND LOOP;\t\t\t \tRETURN; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_Sequences(a_SchemaName NAME, a_TableName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_Sequences (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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430  *\/ \/**********************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_Sequences \t(a_SchemaName\tVARCHAR(256) 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*\/ \ta_TableName\tVARCHAR(256) default NULL\t\/* \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 (r_SequenceNumber SMALLINT,r_SequenceName VARCHAR(256), \t\tr_SequenceSchemaName VARCHAR(256),r_SequenceDescription TEXT, \t\tr_SequenceStartValue BIGINT,r_SequenceIncrementBy BIGINT, \t\tr_SequenceMaxValue BIGINT,r_DependType VARCHAR(256), \t\tr_RefTableName VARCHAR(256),r_RefTableSchemaName VARCHAR(256), \t\tr_RefAttributeName VARCHAR(256)) AS $BODY$ DECLARE \tc_Delimiter\t\tCONSTANT VARCHAR(2):=','; --*******************************************************\t\t BEGIN\t\t \tRETURN QUERY SELECT ts.r_SequenceNumber::SMALLINT, \t\t\t\tts.r_SequenceName::VARCHAR(256), \t\t\t\tts.r_SequenceSchemaName::VARCHAR(256), \t\t\t\tts.r_SequenceDescription::TEXT, \t\t\t\tts.r_SequenceStartValue::BIGINT, \t\t\t\tts.r_SequenceIncrementBy::BIGINT, \t\t\t\tts.r_SequenceMaxValue::BIGINT, \t\t\t\tts.r_DependType::VARCHAR(256), \t\t\t\tts.r_RefTableName::VARCHAR(256), \t\t\t\tts.r_RefTableSchemaName::VARCHAR(256), \t\t\t\tts.r_RefAttributeName::VARCHAR(256) \t\t\tFROM admtf_Table_Sequences(a_SchemaName::NAME,a_TableName::NAME) ts; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_Sequences(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 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION;  SELECT * FROM admtf_Table_Sequences('public'::VARCHAR(255), \t\t\t\t'kr_road_network_vertices_pgr'::VARCHAR(255)); SELECT * FROM admtf_Table_Sequences('public'::NAME, \t\t\t\t'kr_road_network_vertices_pgr'::NAME); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"fnTableRC\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admfn_Table_RowCount<\/h3>\n<p>  <a href=\"#fnTableRC_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admfn_Table_RowCount (a_SchemaName NAME,a_TableName NAME); \/******************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435                           *\/ \/******************************************************\/ CREATE OR REPLACE FUNCTION admfn_Table_RowCount \t(a_SchemaName\tNAME 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*\/ \ta_TableName\tNAME 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  BIGINT AS $BODY$ DECLARE\tv_TableNumberOfRowCalc\tBIGINT;\t\t\/* \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e  *\/ \tv_Found\t\t\tBOOLEAN; \t--***********************************************************\t\t BEGIN \tIF a_SchemaName ~ E'^[a-z_0-9]+$' AND  a_TableName ~ E'^[a-z_0-9]+$' THEN\t \t\tEXECUTE 'SELECT count(*) FROM ' ||a_SchemaName ||'.'|| a_TableName  \t\t\t\tINTO v_TableNumberOfRowCalc; \tELSE  \t\tSELECT INTO v_Found true  \t\t\tFROM pg_class tbl  \t\t\t\tINNER JOIN pg_namespace nspc ON tbl.relnamespace = nspc.oid  \t\t\tWHERE tbl.relkind='r' AND tbl.relname=a_TableName  \t\t\t\tAND nspc.nspname=a_SchemaName; \t\tIF FOUND THEN  \t\t\tEXECUTE 'SELECT count(*) FROM ' || \t\t\t\tCASE WHEN a_SchemaName ~ E'^[a-z_0-9]+$'  THEN \t\t\t\t\t  \ta_SchemaName  \t\t\t\t\tELSE quote_ident(a_SchemaName) END  \t\t\t\t\t||'.'||  \t\t\t\tCASE WHEN a_TableName ~ E'^[a-z_0-9]+$' THEN  \t\t\t\t\t\ta_TableName   \t\t\t\t\tELSE quote_ident(a_TableName) END   \t\t\t\tINTO v_TableNumberOfRowCalc; \t\tELSE \t\t\tSELECT INTO v_Found true  \t\t\t\tFROM pg_class tbl  \t\t\t\t\tINNER JOIN pg_namespace nspc ON tbl.relnamespace = nspc.oid  \t\t\t\tWHERE tbl.relkind='r' AND LOWER(tbl.relname)= LOWER(a_TableName)   \t\t\t\t\tAND nspc.nspname=LOWER(a_SchemaName); \t\t\tIF FOUND THEN \t\t\t\tEXECUTE 'SELECT count(*) FROM ' || a_SchemaName\t||'.'||a_TableName \t\t\t\t\t INTO v_TableNumberOfRowCalc; \t\t\tEND IF;\t\t\t \t\tEND IF; \tEND IF;\t \tRETURN v_TableNumberOfRowCalc; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admfn_Table_RowCount(a_SchemaName NAME,a_TableName NAME) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION;BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admfn_Table_RowCount (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 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435                                                    *\/ \/********************************************************************\/ CREATE OR REPLACE FUNCTION admfn_Table_RowCount \t(a_SchemaName\tVARCHAR(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 *\/ \ta_TableName\tVARCHAR(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  BIGINT AS $BODY$ DECLARE\tv_TableNumberOfRowCalc\tBIGINT;\t\t\/* \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e  *\/ --*********************************************************\t\t BEGIN\t\t \tRETURN admfn_Table_RowCount(a_SchemaName::NAME,a_TableName::NAME); END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admfn_Table_RowCount(a_SchemaName VARCHAR(256),a_TableName VARCHAR(256)) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECt admfn_Table_RowCount('public'::NAME,'Street'::NAME); SELECt admfn_Table_RowCount('public'::VARCHAR(256),'Street'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfTableIC\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Table_InheritanceChildrens<\/h3>\n<p>  <a href=\"#tfTableIC_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_InheritanceChildrens (a_SchemaName NAME,a_TableName NAME,a_Mode VARCHAR(10)); \/************************************************************\/ \/*  \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 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 *\/ \/************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_InheritanceChildrens \t(a_SchemaName\t\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*\/ \ta_TableName\t\tNAME default NULL,\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \ta_Mode\t\t\tVARCHAR(10) default 'estimate'                                             \/*\u0420\u0435\u0436\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435*\/  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_TableName NAME,rs_TableDescription TEXT, \t\t\t\trs_NumberOfAttribute INTEGER,rs_NumberOfChecks INTEGER, \t\t\t\trs_hasPKey BOOLEAN,rs_hasIndex BOOLEAN, \t\t\t\trs_hasSubClass BOOLEAN,rs_NumberOfRow INTEGER) AS $BODY$ DECLARE \tc_TableKind\t\tCONSTANT CHAR:='r'; \tc_ExactlyMode\t\tCONSTANT VARCHAR(10):='exactly'; \tc_EstimateMode\t\tCONSTANT VARCHAR(10):='estimate'; \tv_TableOID\t\tOID;\t\t\/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \tv_SchemaName\t\tNAME;\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \tv_TableName\t\tNAME;\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \tv_TableDescription\tTEXT;\t\t\/* \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \tv_TableNumberOfRowCalc\t\tINTEGER;\t\t\/* \u0427\u0438\u0441\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 *\/ \tv_InheritanceRECORD\tRECORD;\t\t\/* \u0417\u0430\u043f\u0438\u0441\u044c \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \tv_InheritanceOID\tOID;\t\t\/* \u0418\u0414 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ BEGIN \tRETURN QUERY SELECT  rtbl.relname,rdsc.description,rtbl.relnatts::INTEGER, \t\t\t\trtbl.relchecks::INTEGER,rtbl.relhaspkey,rtbl.relhasindex, \t\t\t\trtbl.relhassubclass, \t\t\t\tCASE WHEN a_Mode=c_ExactlyMode THEN  \t\t\t\t\tadmfn_Table_RowCount(rnspc.nspname,rtbl.relname)::INTEGER   \t\t\t\t\tELSE rtbl.reltuples::INTEGER END \t\t\t\tFROM pg_class tbl  \t\t\t\t\tINNER JOIN pg_namespace nspc ON tbl.relnamespace = nspc.oid  \t\t\t\t\tLEFT OUTER JOIN pg_Description dsc ON tbl.oid=dsc.objoid \t\t\t\t\t\t\t\tAND dsc.objsubid=0 \t\t\t\t\tINNER JOIN pg_depend dp ON tbl.oid=dp.refobjid \t\t\t\t\tINNER JOIN pg_class rtbl ON rtbl.OID=dp.objid \t\t\t\t\tINNER JOIN pg_namespace rnspc ON rtbl.relnamespace = rnspc.oid  \t\t\t\t\tLEFT OUTER JOIN pg_Description rdsc ON rtbl.oid=rdsc.objoid \t\t\t\t\t\t\t\t\tAND rdsc.objsubid=0 \t\t\t\tWHERE nspc.nspname=LOWER(a_SchemaName)  \t\t\t\t\tAND tbl.relkind=c_TableKind AND rtbl.relkind=c_TableKind \t\t\t\t\tAND tbl.relname =LOWER(a_TableName) \t\t\t\tORDER BY rtbl.relname; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_InheritanceChildrens(a_SchemaName NAME,a_TableName NAME,a_Mode VARCHAR(10)) 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 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Table_InheritanceChildrens (a_SchemaName VARCHAR(256),a_TableName VARCHAR(256),a_TableName NAME,a_Mode VARCHAR(10)); \/************************************************************************\/ \/*  \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 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446                       *\/ \/************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Table_InheritanceChildrens \t(a_SchemaName\t\tVARCHAR(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\t*\/ \ta_TableName\t\tVARCHAR(256) default NULL,\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \ta_Mode\t\t\tVARCHAR(10) default 'estimate'                                                            \/*\u0420\u0435\u0436\u0438\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435*\/ )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rs_TableName VARCHAR(256),rs_TableDescription TEXT, \t\t\trs_NumberOfAttribute INTEGER,rs_NumberOfChecks INTEGER, \t\t\trs_hasPKey BOOLEAN,rs_hasIndex BOOLEAN, \t\t\trs_hasSubClass BOOLEAN,rs_NumberOfRow INTEGER) AS $BODY$ DECLARE \tc_TableKind\t\tCONSTANT CHAR:='r'; BEGIN \tRETURN QUERY SELECT tic.rs_TableName::VARCHAR(256),tic.rs_TableDescription::TEXT, \t\t\t\ttic.rs_NumberOfAttribute::INTEGER,tic.rs_NumberOfChecks::INTEGER, \t\t\t\ttic.rs_hasPKey::BOOLEAN,tic.rs_hasIndex::BOOLEAN, \t\t\t\ttic.rs_hasSubClass::BOOLEAN,tic.rs_NumberOfRow::INTEGER \t\t\tFROM admtf_Table_InheritanceChildrens(a_SchemaName::NAME, \t\t\t\t\ta_TableName::NAME,a_Mode::VARCHAR(10)) tic;\t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Table_InheritanceChildrens(a_SchemaName VARCHAR(256),a_TableName VARCHAR(256),a_Mode VARCHAR(10)) 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 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Table_InheritanceChildrens('public'::NAME,'np_house'::NAME); SELECT * FROM admtf_Table_InheritanceChildrens('public'::VARCHAR(256),'np_house'::VARCHAR(256)); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfAttPK\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Attribute_PKFeatures<\/h3>\n<p>  <a href=\"#tfAttPK_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Attribute_PKFeatures (a_TableOID OID,a_AttributeNo SMALLINT); \/***************************************************************************\/ \/*  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435.                        *\/ \/* \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438 \u0435\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043a\u043e\u043b\u043e\u043d\u043e\u043a  *\/ \/* \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \t\t\t\t                                                                       *\/ \/***************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Attribute_PKFeatures \t(a_TableOID\t\tOID,\t\t\/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \ta_AttributeNo\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 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435*\/\t  )\t\t\t\t\t\t\t\t\t\t  RETURNS  TABLE (rs_isAttributePK BOOLEAN,rs_PKeyName name,rs_ColumnPKNo SMALLINT) AS $BODY$ DECLARE C_PKAttributeList_NDims CONSTANT INTEGER:=1; \t\t\t\t\t\/* \u0420\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \tv_PKAttributeList\tSMALLINT[]; \t\t\t\t\t\/* \u0421\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0435\u0431\u0443\u0442\u043e\u0432 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \tv_PKAttributeIndx\tINTEGER; \t\t\t\t\t\/* \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \tv_PKAttributeLBound\tINTEGER; \t\t\t\t\t\/* \u041d\u0438\u0436\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/\t\t \tv_PKAttributeUBound\tINTEGER; \t\t\t\t\t\/* \u0412\u0435\u0440\u0445\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ --**********************************************************************\tBEGIN\t\t \trs_isAttributePK:=false; \trs_ColumnPKNo:=NULL; \tSELECT INTO rs_PKeyName,v_PKAttributeList,rs_isAttributePK  \t\t\t\tconname,conkey,ARRAY[a_AttributeNo]&lt;@conkey    \t\t\tFROM pg_constraint c  \t\t\tWHERE c.contype='p' and c.conrelid=a_TableOID; \tIF FOUND AND rs_isAttributePK THEN -- \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0432\u0443\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \t\tv_PKAttributeLBound:=array_lower(v_PKAttributeList,C_PKAttributeList_NDims); \t\tv_PKAttributeUBound:=array_upper(v_PKAttributeList,C_PKAttributeList_NDims); \t\tv_PKAttributeIndx:=v_PKAttributeLBound; \t\tWHILE v_PKAttributeIndx &lt;= v_PKAttributeUBound  \t\t\tAND a_AttributeNo&lt;&gt;v_PKAttributeList[v_PKAttributeIndx]  \t\tLOOP \t\t\tv_PKAttributeIndx:=v_PKAttributeIndx+1; \t\tEND LOOP; \t\tIF v_PKAttributeIndx&lt;=v_PKAttributeUBound THEN \t\t\trs_ColumnPKNo:=v_PKAttributeIndx; \t\tEND IF; \tEND IF;\t\t\t \tRETURN QUERY SELECT rs_isAttributePK,rs_PKeyName,rs_ColumnPKNo; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Attribute_PKFeatures(a_TableOID OID,a_AttributeNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Attribute_PKFeatures((SELECT OID FROM pg_class WHERE relname='street'),3::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfAttFK\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Attribute_FKFeatures<\/h3>\n<p>  <a href=\"#tfAttFK_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Attribute_FKFeatures (a_TableOID OID,a_AttributeNo SMALLINT); \/****************************************************************************\/ \/* \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0432\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043a\u043b\u044e\u0447\u0435.           *\/ \/* \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438 \u0435\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 *\/ \/* \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430.                                                   *\/ \/****************************************************************************\/ \/****************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Attribute_FKFeatures \t(a_TableOID\t\tOID,\t\t\/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \ta_AttributeNo\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 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435*\/  )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rs_isAttributeFK BOOLEAN,rs_FKeyName name[],rs_ColumnFKNo SMALLINT[],rs_FKTableName name[],rs_FKTableColumnName name[]) AS $BODY$ DECLARE C_FKAttributeList_NDims CONSTANT INTEGER:=1; \t\t\t\t\/* \u0420\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \tv_FKAttributeList\tSMALLINT[]; \t\t\t\t\/* \u0421\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/ \tv_RefAttributeList\tSMALLINT[]; \t\t\t\t\/* \u0421\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, *\/ \t\t\t\t\/* \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*\/ \tv_FKAttributeIndx\tINTEGER; \t\t\t\t\/* \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/\t\t \tv_RefAttributeListIndx\tINTEGER; \t\t\t\t\/* \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \t\t\t\t\/* \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*\/\t\t \tv_FKAttributeLBound\tINTEGER; \t\t\t\t\/* \u041d\u0438\u0436\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/\t\t \tv_FKAttributeUBound\tINTEGER; \t\t\t\t\/* \u0412\u0435\u0440\u0445\u043d\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043c\u0430\u0441\u0441\u0441\u0438\u0432\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/\t \tv_FKConstraintIndx\tINTEGER; \t\t\t\t\/* \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430*\/\t\t \tv_FKeyName\t\tname; \t\t\t\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, *\/ \t\t\t\t\/* \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447*\/ \tv_FKTableName\t\tname; \t\t\t\t\/* \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*\/ \tv_FKTableColumnName \tname; \t\t\t\t\/* \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, *\/ \t\t\t\t\/* \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*\/ \tv_RefAttributeNo\tSMALLINT; \t\t\t\t\/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, *\/ \t\t\t\t\/* \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*\/\t \tv_Constraint\t\tpg_constraint%ROWTYPE;  \t\t\t\t\/* \u0417\u0430\u043f\u0438\u0441\u044c \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f *\/ \t\t\t\t\/* \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (CONSTRANT) *\/ \t \t \t--******************************************************************************************************\t\t BEGIN\t\t \trs_isAttributeFK:=false; \trs_ColumnFKNo:=NULL; \tv_FKConstraintIndx:=0; \tFOR v_Constraint IN SELECT *  FROM pg_constraint c  \t\t\t\tWHERE c.contype='f' and c.conrelid=a_TableOID  \t\t\t\t\tAND ARRAY[a_AttributeNo]&lt;@conkey  \t\t\t\tORDER BY c.oid \t  LOOP \t\tv_FKConstraintIndx:=v_FKConstraintIndx+1; \t\trs_isAttributeFK:=true; \t\tv_FKeyName:=v_Constraint.conname; \t\tv_FKAttributeList:=v_Constraint.conkey; \t\tv_RefAttributeList:=v_Constraint.confkey; \t\tv_FKAttributeLBound:=array_lower(v_FKAttributeList,C_FKAttributeList_NDims); \t\tv_FKAttributeUBound:=array_upper(v_FKAttributeList,C_FKAttributeList_NDims); \t\tv_FKAttributeIndx:=v_FKAttributeLBound; \t\tWHILE v_FKAttributeIndx &lt;= v_FKAttributeUBound  \t\t\tAND a_AttributeNo&lt;&gt;v_FKAttributeList[v_FKAttributeIndx]  \t\tLOOP \t\t\tv_FKAttributeIndx:=v_FKAttributeIndx+1; \t\tEND LOOP; \t\trs_FKeyName[v_FKConstraintIndx]:=v_FKeyName; \t\trs_ColumnFKNo[v_FKConstraintIndx]:=v_FKAttributeIndx; \t\tSELECT INTO v_FKTableName ftbl.relname  \t\t\tFROM pg_class ftbl WHERE ftbl.oid=v_Constraint.confrelid; \t\trs_FKTableName[v_FKConstraintIndx]:=v_FKTableName; \t\tv_RefAttributeNo:=v_RefAttributeList[v_FKAttributeIndx]; \t\tv_FKTableColumnName:=NULL; \t\tSELECT INTO v_FKTableColumnName attname  \t\t\tFROM pg_attribute a  \t\t\tWHERE a.attrelid=v_Constraint.confrelid AND a.attnum=v_RefAttributeNo; \t\trs_FKTableColumnName[v_FKConstraintIndx]:=v_FKTableColumnName; \tEND LOOP; \tRETURN QUERY SELECT rs_isAttributeFK,rs_FKeyName,rs_ColumnFKNo, \t\t\t\trs_FKTableName,rs_FKTableColumnName; END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Attribute_FKFeatures(a_TableOID OID,a_AttributeNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0432\u0438\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \u0438 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0430'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Attribute_FKFeatures((SELECT OID FROM pg_class WHERE relname='street'),4::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <a name=\"tfAttF\"><\/a>  <\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 admtf_Attribute_Features<\/h3>\n<p>  <a href=\"#tfAttF_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<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS admtf_Attribute_Features (a_TableOID OID,a_AttributeNo SMALLINT); \/****************************************************************************\/ \/* \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 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b           *\/ \/****************************************************************************\/ CREATE OR REPLACE FUNCTION admtf_Attribute_Features \t(a_TableOID\tOID,\t\/* \u0418\u0414 \u0442\u0430\u0431\u043b\u0438\u0446\u044b *\/ \ta_AttributeNo\tSMALLINT\/* \u041f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435*\/\t  )\t\t\t\t\t\t\t\t\t\t   RETURNS  TABLE (rsa_AttributeName name,rsa_UserTypeName VARCHAR(256),rsa_TypeName VARCHAR(256),rsa_isNotNULL BOOLEAN,rsa_isAttributePK BOOLEAN, \t\trsa_ColumnPKNo SMALLINT,rsa_Description Text,rsa_isAttributeFK BOOLEAN,rsa_FKeyName name[],rsa_ColumnFKNo SMALLINT[],rsa_FKTableName name[],rsa_FKTableColumnName name[]) AS $BODY$ DECLARE \t \tv_Return_Error \tInteger := 0;\t\t\/* \u041a\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430*\/\t\t \t \t--*********************************************************************\t\t BEGIN\t \tSELECT INTO rsa_AttributeName,rsa_UserTypeName,rsa_TypeName, \t\t\trsa_isNotNULL,rsa_Description \t\tattr.attname, \t\tCASE WHEN COALESCE(typ.typbasetype,0)&gt;0 THEN typ.typname::VARCHAR(100)  \t\t\t\t\tELSE ''END AS r_UserTypeName, \t\tFORMAT_TYPE(COALESCE(NULLIF(typ.typbasetype,0),typ.oid),  \t\t\tCOALESCE(NULLIF(typ.typtypmod,-1),attr.atttypmod))::VARCHAR(256) AS r_TypeName,\t\t\t\t \t\tattr.attnotnull AS r_isNotNULL, \t\tdsc.description AS r_Description  \tFROM pg_attribute attr  \t\t\tLEFT OUTER JOIN pg_type typ ON attr.atttypid=typ.oid \t\t\tLEFT OUTER JOIN pg_type btyp ON typ.typbasetype=btyp.oid \t\t\tLEFT OUTER JOIN pg_description dsc ON dsc.objoid=attr.attrelid \t\t\t\t\t\tAND dsc.objsubid=attr.attnum \tWHERE attr.attrelid =a_TableOID AND attr.attnum=a_AttributeNo;\t \tSELECT INTO rsa_isAttributePK,rsa_ColumnPKNo  rs_isAttributePK,rs_ColumnPKNo  \t\tFROM admtf_Attribute_PKFeatures(a_TableOID,a_AttributeNo); \tSELECT INTO rsa_isAttributeFK,rsa_FKeyName,rsa_ColumnFKNo,rsa_FKTableName, \t\t\trsa_FKTableColumnName rs_isAttributeFK,rs_FKeyName, \t\t\trs_ColumnFKNo,rs_FKTableName,rs_FKTableColumnName \t\tFROM admtf_Attribute_FKFeatures(a_TableOID,a_AttributeNo); \tRETURN QUERY SELECT rsa_AttributeName,rsa_UserTypeName,rsa_TypeName,rsa_isNotNULL, \t\t\trsa_isAttributePK,rsa_ColumnPKNo,rsa_Description,rsa_isAttributeFK, \t\t\trsa_FKeyName,rsa_ColumnFKNo,rsa_FKTableName,rsa_FKTableColumnName; \t END $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION admtf_Attribute_Features(a_TableOID OID,a_AttributeNo SMALLINT) IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; SELECT * FROM admtf_Attribute_Features ((SELECT OID FROM pg_class WHERE relname='street'),2::SMALLINT); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/h3>\n<p>  <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><\/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\/418597\/\"> https:\/\/habr.com\/post\/418597\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418597\/\" class=\"post__text post__text-html js-mediator-article\">\u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\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. <\/p>\n<p>  <a href=\"https:\/\/habr.com\/post\/415575\/\">\u041f\u0435\u0440\u0432\u0430\u044f<\/a> \u0438 <a href=\"https:\/\/habr.com\/post\/415897\/\">\u0432\u0442\u043e\u0440\u0430\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>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 <b>\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/b>, \u0430 \u0442\u0430\u043a\u0436\u0435 <b>\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0442\u0430\u0431\u043b\u0438\u0446<\/b>.   <\/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-287684","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287684","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=287684"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287684\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}