{"id":281929,"date":"2016-12-02T17:25:04","date_gmt":"2016-12-02T14:25:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=281929"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=281929","title":{"rendered":"\u0410\u0434\u0440\u0435\u0441\u0430 \u0424\u0418\u0410\u0421 \u0432 \u0441\u0440\u0435\u0434\u0435 PostgreSQL. \u0427\u0430\u0441\u0442\u044c 3"},"content":{"rendered":"<p>\u0410\u0434\u0440\u0435\u0441\u0430 \u0424\u0418\u0410\u0421 \u0432 \u0441\u0440\u0435\u0434\u0435 PostgreSQL. \u0427\u0430\u0441\u0442\u044c 3<br \/>  \u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 <br \/>  \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0424\u0418\u0410\u0421, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c PostgreSQL. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 <br \/>  \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0430\u0442\u044c\u0441\u044f \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/habrahabr.ru\/post\/316314\/\">habrahabr.ru\/post\/316314<\/a>, <br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/316380\/\">habrahabr.ru\/post\/316380<\/a><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/94a\/cb7\/fbc\/94acb7fbc32a4cf18fd15e854b62360c.png\"\/><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 4 \u0447\u0430\u0441\u0442\u0435\u0439.<br \/>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \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\u0438. \u0412\u043e <br \/>  \u0432\u0442\u043e\u0440\u043e\u0439- \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <br \/>  \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 <br \/>  <a href=\"#Script4\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e<\/a>. <\/p>\n<h2>\u041f\u043e\u0438\u0441\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/h2>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f fstf_AddressObjects_SearchByName \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0430\u0434\u0440\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0424\u0418\u0410\u0421 \u043f\u043e \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u044f\u043b\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c \u0438 \u0442\u0438\u043f\u0430\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0434\u0432\u0443\u0445 \u0435\u0433\u043e \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u043f\u0440\u0435\u0434\u043a\u043e\u0432.<br \/>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0418 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e \u00ab\u0413\u0440\u0438\u0431\u043d\u043e\u0439\u00bb. <\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 8. \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 fstf_AddressObjects_SearchByName(&#8216;\u0413\u0440\u0438\u0431\u043d\u043e\u0439&#8217;)<\/strong><\/p>\n<table>\n<tr>\n<th>AOGUID<\/th>\n<th>AOLevel<\/th>\n<th>\u041f\u043e\u043b\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441<\/th>\n<th>ShortName<\/th>\n<th>FormalName<\/th>\n<th>CurrStatus<\/th>\n<th>ActStatus<\/th>\n<\/tr>\n<tr>\n<td>15faf08c-78b6-4b92-8a56-2ff70f2c4cab<\/td>\n<td>6<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>\u043f<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>f1772172-4dd1-449d-b2d2-ab96883d8871<\/td>\n<td>7<\/td>\n<td>\u041a\u0435\u0436\u0435\u043c\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0433 \u041a\u043e\u0434\u0438\u043d\u0441\u043a, \u043f\u0435\u0440 \u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>146cbcb5-4ad9-4578-916f-80ebd5c2b846<\/td>\n<td>7<\/td>\n<td>\u0415\u043c\u0435\u043b\u044c\u044f\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u042d\u043b\u0438\u0442\u0430, \u043f\u0435\u0440 \u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>a8ee8caf-fd5f-489c-92d9-f560e3f93c8b<\/td>\n<td>7<\/td>\n<td>\u0421\u0443\u0445\u043e\u0431\u0443\u0437\u0438\u043c\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0434 \u0428\u0435\u0441\u0442\u0430\u043a\u043e\u0432\u043e, \u043f\u0435\u0440 \u0413\u0440\u0438\u0431\u043d\u043e\u0439 <\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>84f4baa8-1db2-471d-967d-20d489bca68e<\/td>\n<td>7<\/td>\n<td>\u041a\u0443\u0440\u0430\u0433\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0441 \u0422\u044e\u0445\u0442\u044f\u0442, \u043f\u0435\u0440 \u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>1f2b7975-ce05-4627-bd13-d8d6228accd7<\/td>\n<td>7<\/td>\n<td>\u0433 \u0421\u043e\u0440\u0441\u043a, \u043f\u0435\u0440 \u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<\/tr>\n<\/table>\n<p>  \u0412 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u044b \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441. \u041d\u0430\u0439\u0434\u0435\u043c \u0432\u0441\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e \u00ab\u0413\u0440\u0438\u0431\u043d\u043e\u0439\u00bb. <\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 9. \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 fstf_AddressObjects_SearchByName<br \/>  (NULL,NULL,&#8217;\u0413\u0440\u0438\u0431\u043d\u043e\u0439&#8217;)<\/strong><\/p>\n<table>\n<tr>\n<th>AOGUID<\/th>\n<th>AOLevel<\/th>\n<th>\u041f\u043e\u043b\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441<\/th>\n<th>ShortName<\/th>\n<th>FormalName<\/th>\n<th>CurrStatus<\/th>\n<th>ActStatus<\/th>\n<th>Parent ShortName<\/th>\n<th>Parent FormalName<\/th>\n<\/tr>\n<tr>\n<td>45064ade-a0a7-4258-88c8-baa57094aa2d<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u0413\u0440\u0438\u0431\u043d\u043e\u0439, \u0443\u043b \u0416\u0435\u043b\u0435\u0437\u043d\u043e\u0434\u043e\u0440\u043e\u0436\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u0416\u0435\u043b\u0435\u0437\u043d\u043e\u0434\u043e\u0440\u043e\u0436\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u043f<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<\/tr>\n<tr>\n<td>ba4ec53c-50b7-4325-866a-81f97a38214c<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u0413\u0440\u0438\u0431\u043d\u043e\u0439, \u0443\u043b \u0417\u0430\u043f\u0430\u0434\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u0417\u0430\u043f\u0430\u0434\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u043f<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<\/tr>\n<tr>\n<td>d6e9e0cc-e944-4deb-a09c-c545af691836<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u0413\u0440\u0438\u0431\u043d\u043e\u0439, \u0443\u043b \u0421\u0435\u0432\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u0421\u0435\u0432\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u043f<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<\/tr>\n<tr>\n<td>5ae71e68-5477-446b-b878-0a9c9bf3bdcd<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u043f \u0413\u0440\u0438\u0431\u043d\u043e\u0439, \u0443\u043b \u042e\u0436\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u042e\u0436\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u043f<\/td>\n<td>\u0413\u0440\u0438\u0431\u043d\u043e\u0439<\/td>\n<\/tr>\n<\/table>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439, \u0442.\u043a. \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0445 \u043d\u0435\u0442 \u0441\u043b\u043e\u0432\u0430 \u00ab\u0413\u0440\u0438\u0431\u043d\u043e\u0439\u00bb, \u043d\u043e \u043e\u043d\u043e \u0435\u0441\u0442\u044c \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u043a\u0430.<br \/>  \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u0440\u0430\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u043e\u043b\u0436\u043d\u043e <br \/>  \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e \u00ab\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439\u00bb, \u0430 \u0432 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0435\u0433\u043e \u0432\u043d\u0443\u043a\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c <br \/>  \u0447\u0430\u0441\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u00ab\u041e\u0437_\u0440\u043d\u00bb. \u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u2014 \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u00ab_\u00bb. \u042d\u0442\u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b. \u0417\u0434\u0435\u0441\u044c \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u00ab\u041e\u0437\u0435\u0440\u043d\u044b\u0439\u00bb \u0438\u043b\u0438 \u00ab\u041e\u0437\u0435\u0440\u043d\u0430\u044f\u00bb, \u043d\u043e \u0438 \u00ab\u041e\u0437\u0451\u0440\u043d\u044b\u0439\u00bb \u0438\u043b\u0438 \u00ab\u041e\u0437\u0451\u0440\u043d\u0430\u044f\u00bb.<\/p>\n<p>  <strong>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 9. \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 fstf_AddressObjects_SearchByName(NULL,NULL,&#8217;\u0413\u0440\u0438\u0431\u043d\u043e\u0439&#8217;)<\/strong><\/p>\n<table>\n<tr>\n<th>AOGUID<\/th>\n<th>AOLevel<\/th>\n<th>\u041f\u043e\u043b\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441<\/th>\n<th>ShortName<\/th>\n<th>FormalName<\/th>\n<th>CurrStatus<\/th>\n<th>ActStatus<\/th>\n<th>Parent ShortName<\/th>\n<th>Parent FormalName<\/th>\n<th>Grand Parent ShortName<\/th>\n<th>Grand Parent FormalName<\/th>\n<\/tr>\n<tr>\n<td>715eef9d-48f6-4322-bcaa-9d239e89b7e4<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0434 \u0411\u0430\u0440\u0430\u0431\u0430\u043d\u043e\u0432\u043a\u0430, \u043f\u0435\u0440 \u041e\u0437\u0435\u0440\u043d\u044b\u0439<\/td>\n<td>\u043f\u0435\u0440<\/td>\n<td>\u041e\u0437\u0435\u0440\u043d\u044b\u0439<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u0434<\/td>\n<td>\u0411\u0430\u0440\u0430\u0431\u0430\u043d\u043e\u0432\u043a\u0430<\/td>\n<td>\u0440-\u043d<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439<\/td>\n<\/tr>\n<tr>\n<td>05c7b2ad-e405-4c8b-9503-6761971e858e<\/td>\n<td>7<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0434 \u0418\u043b\u044c\u0438\u043d\u043a\u0430, \u0443\u043b \u041e\u0437\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u041e\u0437\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u0434<\/td>\n<td>\u0418\u043b\u044c\u0438\u043d\u043a\u0430<\/td>\n<td>\u0440-\u043d<\/td>\n<td>\u0410\u0447\u0438\u043d\u0441\u043a\u0438\u0439<\/td>\n<\/tr>\n<tr>\n<td>bdfcd515-1851-4caf-83ba-12ee79f9f6a7<\/td>\n<td>7<\/td>\n<td>\u041a\u0430\u0437\u0430\u0447\u0438\u043d\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0441 \u0414\u0443\u0434\u043e\u0432\u043a\u0430, \u0443\u043b \u041e\u0437\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>\u0443\u043b<\/td>\n<td>\u041e\u0437\u0435\u0440\u043d\u0430\u044f<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>\u0441<\/td>\n<td>\u0414\u0443\u0434\u043e\u0432\u043a\u0430<\/td>\n<td>\u0440-\u043d<\/td>\n<td>\u041a\u0430\u0437\u0430\u0447\u0438\u043d\u0441\u043a\u0438\u0439<\/td>\n<\/tr>\n<\/table>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u044b \u0443\u043b\u0438\u0446\u044b \u041e\u0437\u0435\u0440\u043d\u0430\u044f \u0438 \u043f\u0435\u0440\u0435\u0443\u043b\u043e\u043a \u043e\u0437\u0435\u0440\u043d\u044b\u0439 \u0432 \u0442\u0440\u0435\u0445 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0443\u043d\u043a\u0442\u0430\u0445 \u0410\u0447\u0438\u043d\u0441\u043a\u043e\u0433\u043e \u0438 \u041a\u0430\u0437\u0430\u0447\u0438\u043d\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0439\u043e\u043d\u043e\u0432 \u041a\u0440\u0430\u0441\u043d\u043e\u044f\u0440\u0441\u043a\u043e\u0433\u043e \u043a\u0440\u0430\u044f.<br \/>  \u0422\u0435\u043a\u0441\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <a href=\"#Script4\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u00ab\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fstf_AddressObjects_SearchByName\u00bb<\/a>.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0432\u0443\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u2013 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e (a_FormalName) \u0438 <br \/>  \u0442\u0438\u043f\u0443 (a_ShortName) \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0442\u043e \u043f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b fias_AddressObjects. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440, \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u00ab%\u00bb. \u042d\u0442\u0438\u043c \u0436\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u0430 \u0438 \u0441\u043b\u0435\u0432\u0430. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 LIKE. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0420\u0438\u0441. 4.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c5b\/894\/825\/c5b894825cce4aed9ce2935bbb009a4a.png\"\/><\/p>\n<p>  <strong>\u0420\u0438\u0441. 4. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u043e\u0438\u0441\u043a \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/strong><\/p>\n<p>  \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f CurrStatus \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u00ab\u0420\u043e\u0434\u043e\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u00bb \u00ab\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00bb. <\/p>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432: \u0442\u0440\u0435\u0442\u044c\u0435\u043c\u0443 (a_ParentFormalName), \u0438\u043b\u0438 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u043c\u0443 (a_ParentShortName). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c (INNER JOIN) \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 fias_AddressObjects \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 pfa.AOGUID=cfa.ParentGUID.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0420\u0438\u0441. 5.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d96\/762\/c10\/d96762c10c584586b34b23a12645e6d7.png\"\/><\/p>\n<p>  <strong>\u0420\u0438\u0441. 5. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/strong><\/p>\n<p>  \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430.<br \/>  \u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443 \u043f\u0440\u0430\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432: \u043f\u044f\u0442\u043e\u043c\u0443 (a_GrandParentFormalName) \u0438\u043b\u0438 \u0448\u0435\u0441\u0442\u043e\u043c\u0443 (a_GrandParentShortName). \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0434\u0432\u043e\u0439\u043d\u044b\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c (INNER JOIN) \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 fias_AddressObjects \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438 \u043f\u0440\u0430\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0430 \u0420\u0438\u0441. 6.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/464\/42f\/7e0\/46442f7e0e8844f58bdd4f3abc097ce1.png\"\/><\/p>\n<p>  <strong>\u0420\u0438\u0441. 6. \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443 \u043f\u0440\u0430\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/strong><\/p>\n<p>  \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430.  <\/p>\n<h2>\u041f\u0420\u0418\u041b\u041e\u0416\u0415\u041d\u0418\u0415<\/h2>\n<p>  <a name=\"Script4\"><\/a><\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fstf_AddressObjects_SearchByName<\/h3>\n<p>  <\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION; DROP FUNCTION IF EXISTS fstf_AddressObjects_SearchByName(   a_FormalName VARCHAR(150), a_ShortName VARCHAR(20),   a_ParentFormalName VARCHAR(150),a_ParentShortName VARCHAR(20),   a_GrandParentFormalName VARCHAR(150),a_GrandParentShortName VARCHAR(20)); \/************************************************************************\/ \/* \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0424\u0418\u0410\u0421 *\/ \/* \u043f\u043e \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443\t \t\t                        *\/ \/***********************************************************************\/\t CREATE OR REPLACE FUNCTION fstf_AddressObjects_SearchByName(   a_FormalName VARCHAR(150),\t \/* \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 *\/                                       \/* \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/   a_ShortName VARCHAR(20) default NULL,\t\/* \u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 *\/                                       \/*\u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/  a_ParentFormalName \tVARCHAR(150) default NULL, \/* \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 *\/                                      \/* \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/  a_ParentShortName VARCHAR(20) default NULL,\t\/* \u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 *\/                                      \/*\u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/  a_GrandParentFormalName VARCHAR(150) default NULL, \/*\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 *\/                                      \/* \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/  a_GrandParentShortName\tVARCHAR(20) default NULL\t\/* \u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 *\/                                      \/* \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/ ) RETURNS  TABLE (rtf_AOGUID VARCHAR(36),                 rtf_AOLevel INTEGER,                 rtf_AddressObjectsFullName VARCHAR(1000),                 rtf_ShortName VARCHAR(20),                 rtf_FormalName VARCHAR(150),                 rtf_CurrStatus INTEGER,                 rtf_ParentShortName VARCHAR(20),                 rtf_ParentFormalName VARCHAR(150),                 rtf_GrandParentShortName VARCHAR(20),                  rtf_GrandParentFormalName VARCHAR(150)) AS\t\t $BODY$ DECLARE \tc_WildChar   CONSTANT VARCHAR(2)='%'; \tc_BlankChar  CONSTANT VARCHAR(2)=' '; \tv_FormalNameTemplate VARCHAR(150); \/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f *\/                                      \/* \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/ \tv_ShortNameTemplate\t\tVARCHAR(20);\t\/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0438\u043f\u0430 *\/                                      \/* \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/ \tv_ParentFormalNameTemplate VARCHAR(150); \/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f *\/                                      \/* \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/ \tv_ParentShortNameTemplate VARCHAR(20); \/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0438\u043f\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e *\/                                      \/* \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/ \tv_GrandParentFormalNameTemplate\tVARCHAR(150);\t\/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 *\/                                      \/* \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430*\/ \tv_GrandParentShortNameTemplate\tVARCHAR(20);\t\/* \u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0438\u043f\u0430 *\/                                      \/* \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 *\/ --************************************************************ --************************************************************  BEGIN \tv_ShortNameTemplate:=UPPER(COALESCE(c_WildChar||                                  REPLACE(TRIM(a_ShortName),c_BlankChar,c_WildChar)||                                 c_WildChar,c_WildChar)); \tv_FormalNameTemplate:=UPPER(c_WildChar||                                  REPLACE(TRIM(a_FormalName),c_BlankChar,c_WildChar)||                                 c_WildChar); \tIF a_ParentFormalName IS NULL AND a_ParentShortName IS NULL  \t\t\tAND a_GrandParentFormalName IS NULL                          AND a_GrandParentShortName IS NULL THEN \t\tRETURN QUERY                 SELECT cfa.AOGUID,cfa.AOLevel,                        fsfn_AddressObjects_TreeActualName(cfa.AOGUID),                        cfa.ShortName,cfa.FORMALNAME,                         cfa.currstatus,NULL::VARCHAR,NULL::VARCHAR, \t\t\tNULL::VARCHAR,NULL::VARCHAR                   FROM fias_AddressObjects cfa                    WHERE cfa.currstatus=                         CASE WHEN 0 &lt; ALL(SELECT iao.currstatus FROM fias_AddressObjects iao                                                              WHERE cfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                               WHERE cfa.aoguid = iao.aoguid) \t\t\t           ELSE 0                              END                        AND UPPER(cfa.FORMALNAME) LIKE v_FormalNameTemplate                        AND  UPPER(cfa.ShortName) LIKE v_ShortNameTemplate                   ORDER BY cfa.AOLevel,cfa.ShortName,cfa.FORMALNAME; \tELSIF a_ParentFormalName IS NOT NULL \t\t\tAND a_GrandParentFormalName IS NULL  \t\t\tAND a_GrandParentShortName IS NULL THEN \t\tv_ParentShortNameTemplate:=UPPER(COALESCE(c_WildChar||                                  REPLACE(TRIM(a_ParentShortName),c_BlankChar,c_WildChar)||                                  c_WildChar,c_WildChar)); \t\tv_ParentFormalNameTemplate:=UPPER(c_WildChar||                                  REPLACE(TRIM(a_ParentFormalName),c_BlankChar,c_WildChar)||                                  c_WildChar); \t\tv_FormalNameTemplate:=COALESCE(v_FormalNameTemplate,c_WildChar);                 RETURN QUERY                  SELECT cfa.AOGUID,cfa.AOLevel,fsfn_AddressObjects_TreeActualName(cfa.AOGUID),                              cfa.ShortName,cfa.FORMALNAME,cfa.currstatus,                              pfa.ShortName,pfa.FORMALNAME,                              NULL::VARCHAR,NULL::VARCHAR                  FROM fias_AddressObjects pfa                          INNER JOIN fias_AddressObjects cfa ON pfa.AOGUID=cfa.ParentGUID                  WHERE cfa.currstatus=CASE WHEN 0 &lt;                          ALL (SELECT iao.currstatus FROM fias_AddressObjects iao                                                              WHERE cfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                              WHERE cfa.aoguid = iao.aoguid)                                   ELSE 0 END                      AND pfa.currstatus=CASE WHEN 0 &lt;                           ALL(SELECT iao.currstatus FROM fias_AddressObjects iao                                                            WHERE pfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                            WHERE pfa.aoguid = iao.aoguid)                                   ELSE 0 END                      AND UPPER(pfa.FORMALNAME) LIKE v_ParentFormalNameTemplate                       AND  UPPER(pfa.ShortName) LIKE v_ParentShortNameTemplate                      AND UPPER(cfa.FORMALNAME) LIKE v_FormalNameTemplate                       AND  UPPER(cfa.ShortName) LIKE v_ShortNameTemplate                 ORDER BY pfa.ShortName,pfa.FORMALNAME,                     cfa.AOLevel,cfa.ShortName,cfa.FORMALNAME;\t \tELSE \t\tv_GrandParentShortNameTemplate:=UPPER(COALESCE(c_WildChar||                                  REPLACE(TRIM(a_GrandParentShortName),c_BlankChar,c_WildChar)||                                  c_WildChar,c_WildChar)); \t\tv_GrandParentFormalNameTemplate:=UPPER(c_WildChar||                                  REPLACE(TRIM(a_GrandParentFormalName),c_BlankChar,c_WildChar)||                                  c_WildChar); \t\tv_ParentShortNameTemplate:=COALESCE(UPPER(COALESCE(c_WildChar||                                  REPLACE(TRIM(a_ParentShortName),c_BlankChar,c_WildChar)||                                  c_WildChar,c_WildChar)),c_WildChar); \t\tv_ParentFormalNameTemplate:=COALESCE(UPPER(c_WildChar||                                 REPLACE(TRIM(a_ParentFormalName),c_BlankChar,c_WildChar)||                                 c_WildChar),c_WildChar); \t\tv_FormalNameTemplate:=COALESCE(v_FormalNameTemplate,c_WildChar);                 RETURN QUERY                  SELECT cfa.AOGUID,cfa.AOLevel,fsfn_AddressObjects_TreeActualName(cfa.AOGUID),                             cfa.ShortName,cfa.FORMALNAME,                             cfa.currstatus,pfa.ShortName,pfa.FORMALNAME,                             gpfa.ShortName,gpfa.FORMALNAME                   FROM fias_AddressObjects gpfa                             INNER JOIN fias_AddressObjects pfa ON gpfa.AOGUID=pfa.ParentGUID                           INNER JOIN fias_AddressObjects cfa ON pfa.AOGUID=cfa.ParentGUID                   WHERE cfa.currstatus=CASE WHEN 0 &lt;                          ALL(SELECT iao.currstatus FROM fias_AddressObjects iao                                                             WHERE \tcfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                              WHERE cfa.aoguid = iao.aoguid)                                  ELSE 0 END                         AND pfa.currstatus=CASE WHEN 0 &lt;                            ALL(SELECT iao.currstatus FROM fias_AddressObjects iao                                                             WHERE pfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                             WHERE pfa.aoguid = iao.aoguid)                                   ELSE 0 END                         AND gpfa.currstatus=CASE WHEN 0 &lt;                            ALL(SELECT iao.currstatus FROM fias_AddressObjects iao                                                            WHERE gpfa.aoguid = iao.aoguid)                                   THEN (SELECT MAX(iao.currstatus) FROM fias_AddressObjects iao                                                             WHERE gpfa.aoguid = iao.aoguid)                                   ELSE 0 END                         AND UPPER(gpfa.FORMALNAME) LIKE v_GrandParentFormalNameTemplate                         AND  UPPER(gpfa.ShortName) LIKE v_GrandParentShortNameTemplate                         AND UPPER(pfa.FORMALNAME) LIKE v_ParentFormalNameTemplate                          AND  UPPER(pfa.ShortName) LIKE v_ParentShortNameTemplate                         AND UPPER(cfa.FORMALNAME) LIKE v_FormalNameTemplate                          AND  UPPER(cfa.ShortName) LIKE v_ShortNameTemplate                   ORDER BY gpfa.ShortName,gpfa.FORMALNAME,                         pfa.ShortName,pfa.FORMALNAME,                         cfa.AOLevel,cfa.ShortName,cfa.FORMALNAME;  \tEND IF; END;  $BODY$ LANGUAGE plpgsql; COMMENT ON FUNCTION fstf_AddressObjects_SearchByName(    a_FormalName VARCHAR(150),a_ShortName VARCHAR(20),    a_ParentFormalName VARCHAR(150),a_ParentShortName VARCHAR(20),    a_GrandParentFormalName VARCHAR(150),a_GrandParentShortName VARCHAR(20))    IS '\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0424\u0418\u0410\u0421 \u043f\u043e \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0438 \u0442\u0438\u043f\u0443'; --ROLLBACK TRANSACTION; COMMIT TRANSACTION; --SELECT * FROM fstf_AddressObjects_SearchByName('\u0411\u041e\u0420\u041e\u0414\u0418\u041d','\u0433'); --SELECT * FROM fstf_AddressObjects_SearchByName('\u0411\u041e\u0420\u041e\u0414\u0418\u041d'); --SELECT * FROM fstf_AddressObjects_SearchByName('\u0434\u0432\u0430',NULL,'\u041c\u0418\u0413\u041d\u0410'); --SELECT * FROM fstf_AddressObjects_SearchByName(NULL,NULL,'\u041c\u0418\u0413\u041d\u0410'); --SELECT * FROM fstf_AddressObjects_SearchByName('\u0417\u0435\u043b_\u043d\u0430\u044f','\u0423\u041b',NULL); SELECT * FROM fstf_AddressObjects_SearchByName('\u0417\u0435\u043b_\u043d\u0430\u044f','\u0423\u041b','\u041a\u0443\u0432\u0430\u0440\u0448\u0438\u043d\u043e',NULL,'\u0415\u043c\u0435\u043b\u044c\u044f\u043d'); <\/code><\/pre>\n<p> \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:\/\/habrahabr.ru\/post\/316622\/\"> https:\/\/habrahabr.ru\/post\/316622\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0410\u0434\u0440\u0435\u0441\u0430 \u0424\u0418\u0410\u0421 \u0432 \u0441\u0440\u0435\u0434\u0435 PostgreSQL. \u0427\u0430\u0441\u0442\u044c 3<br \/>  \u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0430\u0434\u0440\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0438\u0445 <br \/>  \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0424\u0418\u0410\u0421, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c PostgreSQL. \u0421 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 <br \/>  \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0430\u0442\u044c\u0441\u044f \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/habrahabr.ru\/post\/316314\/\">habrahabr.ru\/post\/316314<\/a>, <br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/316380\/\">habrahabr.ru\/post\/316380<\/a><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/94a\/cb7\/fbc\/94acb7fbc32a4cf18fd15e854b62360c.png\"\/>  <\/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-281929","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281929","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=281929"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281929\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}