{"id":340066,"date":"2022-10-21T15:00:28","date_gmt":"2022-10-21T15:00:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=340066"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=340066","title":{"rendered":"<span>\u0418\u043c\u043f\u043e\u0440\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 MSSQL \u043d\u0430 PostgreSQL<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435  <\/h2>\n<p>\u0412 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0431\u044b\u043b\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 MSSQL (\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435), \u0430 \u0442\u0430\u043a\u0436\u0435 PostgreSQL Pro Enterprise 10.3, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430\u044f \u043d\u0430 CentOS 7 (\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c). \u041d\u0443 \u0438 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a FreeTDS<\/h2>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c freetds \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 (<a href=\"http:\/\/mirrors.ibiblio.org\/freetds\/stable\/freetds-0.91.tar.gz\" rel=\"noopener noreferrer nofollow\">freetds-0.91.tar.gz<\/a>) \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 (<a href=\"http:\/\/mirrors.ibiblio.org\/freetds\/stable\/\" rel=\"noopener noreferrer nofollow\">http:\/\/mirrors.ibiblio.org\/freetds\/stable\/<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e WinSCP \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430 postgres \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043b\u044e\u0431\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 (\u0423 \u043c\u0435\u043d\u044f \/home\/myuser\/)<\/p>\n<\/li>\n<li>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 <\/p>\n<p><code>tar -zxvf freetds-0.91.tar.gz<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a: gcc-c++, ncurses-devel<\/p>\n<p>(\u041c\u043e\u0436\u0435\u0442\u0435 \u043a\u0443\u0441\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u043b\u0438\u0447\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u0435\u0437 \u044d\u0442\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0448\u0430\u0433\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e<\/p>\n<p>  <code>cd freetds-0.91\/<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u2014prefix (\u0443 \u043c\u0435\u043d\u044f \/usr\/local\/freetds)  <\/p>\n<p><code>.\/configure --prefix=\/usr\/local\/freetds --enable-msdblib<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<p><code>make &amp;&amp; make install<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0448\u0438\u0431\u043e\u043a. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0433\u0443\u0433\u043b\u0438\u043c, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0440\u0430\u0437\u0443. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 FreeTDS (\u0432 \u043f\u0430\u043f\u043a\u0443 \/usr\/local\/freetds). \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433-\u0444\u0430\u0439\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043b\u0438\u0431\u043e \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u0432 WinSCP<\/p>\n<p><code>vim \/etc\/ld.so.conf<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0443\u0442\u044c \u0434\u043e lib \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  (\/usr\/local\/freetds\/lib\/) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/p>\n<p><code>ldconfig<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e PATH \u043f\u0443\u0442\u044c \u0434\u043e bin \u043f\u0430\u043f\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  <\/p>\n<p><code>PATH=\/usr\/local\/freetds\/bin:$PATH<\/code><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c tsql \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <\/p>\n<p><code>tsql -C<\/code><\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/p>\n<\/li>\n<li>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e MS \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f) \u0432 freetds.conf \u0444\u0430\u0439\u043b\u0435 (\u0435\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0432\u044b\u0448\u0435)  \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/p>\n<p>[my_server]<br \/> host = serverhost<br \/> port = serverport<br \/> tds version = 7.0<\/p>\n<p>\u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0445\u043e\u0441\u0442 \u0438 \u043f\u043e\u0440\u0442 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 1433), \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u043c\u044f \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445, \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f.  <\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435  <\/p>\n<p><code>tsql -S myserver -U username -P password<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c <\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b <\/p>\n<p><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG='dbName'<\/code><\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 1> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 2> \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e go.<\/p>\n<p>\u0410 \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0439\u0442\u0438\u00a0\u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 MS \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u0438\u0448\u0435\u043c quit \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Enter .<\/p>\n<\/li>\n<\/ol>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 tds_fdw \u043c\u043e\u0434\u0443\u043b\u044f<\/h2>\n<ol>\n<li>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0433\u0438\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u00a0<a href=\"https:\/\/github.com\/tds-fdw\/tds_fdw.git\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tds-fdw\/tds_fdw.git<\/a><\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u0430\u043a zip-\u0430\u0440\u0445\u0438\u0432 \u0440\u0443\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e WinSCP \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430 pg \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043b\u044e\u0431\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 (\u0423 \u043c\u0435\u043d\u044f \/home\/myuser\/)<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p><code>unzip tds_fdw-master.zip<\/code><\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c Makefile \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c (\u0443 \u043c\u0435\u043d\u044f \/home\/myuser\/tds_fdw-master\/Makefile) <\/p>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 SHLIB_LINK \u0438 PG_CPPFLAGS, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 freeTDS (\u043f\u0443\u0442\u044c \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 6 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430)<\/p>\n<\/li>\n<li>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443  <\/p>\n<p><code>make USE_PGXS=1 install<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041e\u0448\u0438\u0431\u043e\u043a \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e.<\/p>\n<p><em>\u041c\u0438\u043d\u0443\u0442\u043a\u0430 \u0442\u0440\u0430\u0431\u043b\u0448\u0443\u0442\u0438\u043d\u0433\u0430<\/em><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 make: pg_config: Command not found<\/p>\n<p>\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 pg_config \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 WinSCP \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/p>\n<p><code>find \/ -depth -name \"pg_config\"<\/code> <\/p>\n<p>b. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 postgres\\*version\\* -devel-\\* \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439  <\/p>\n<p><code>rpm -qa | grep postgres<\/code> <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0435\u0442, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.  \u0412 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u043a\u0430\u0447\u0430\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e rpm \u0440\u0443\u043a\u0430\u043c\u0438, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p><code>yum localinstall \/path\/to\/rpm\/package.rpm<\/code><\/p>\n<p>c. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 pg_config \u0444\u0430\u0439\u043b\u0430. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f  <\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0444\u0430\u0439\u043b tds_fdw.so \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <\/p>\n<p> <code>ldd \/path\/to\/file\/tds_fdw.so<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u0443\u0442\u044c \u0434\u043e lybsybdb.so.5 \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0415\u0441\u043b\u0438 \u043f\u0443\u0442\u044c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043b\u0438\u043d\u043a\u0443 \u0432 \u043f\u0430\u043f\u043a\u0443 \/usr\/lib\/ , \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ldconfig <\/p>\n<p><code>ln -s \/usr\/local\/freetds\/lib\/libsybdb.so.5 \/usr\/lib\/libsybdb.so.5 &amp;&amp; ldconfig<\/code><\/p>\n<p>\u041d\u0410 \u042d\u0422\u041e\u041c \u042d\u0422\u0410\u041f\u0415 \u0420\u0410\u0411\u041e\u0422\u0410 \u0421 \u0421\u0415\u0420\u0412\u0415\u0420\u041e\u041c \u0417\u0410\u0412\u0415\u0420\u0428\u0415\u041d\u0410, \u041f\u0415\u0420\u0415\u0425\u041e\u0414\u0418\u041c \u0412 POSTGRESQL \u041a\u041e\u041d\u0421\u041e\u041b\u042c<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c<\/h2>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435<\/p>\n<p><code>CREATE EXTENSION tds_fdw;<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 tds_fdw \u043c\u043e\u0434\u0443\u043b\u044c. <\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<p><code>CREATE SERVER serverName FOREIGN DATA WRAPPER tds_fdw  OPTIONS (servername 'serverName_fromFreetdsConf', database 'dbName', msg_handler 'notice');<\/code><\/p>\n<p>serverName &#8212; \u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 sql \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/p>\n<p>serverName_fromFreetdsConf &#8212; \u0438\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u0432 freetds.conf \u0444\u0430\u0439\u043b\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 1<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440  <\/p>\n<p><code>CREATE USER MAPPING FOR CURRENT_USER SERVER serverName OPTIONS (username 'dbUser', password 'dbUserPswd');<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u0441\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<p><code>IMPORT FOREIGN SCHEMA dbo FROM SERVER serverName INTO localSchema;<\/code><\/p>\n<p>dbo &#8212; \u0438\u043c\u044f \u0441\u0445\u0435\u043c\u044b \u0438\u0437 MS \u0431\u0430\u0437\u044b (\u0432 MS \u0431\u0430\u0437\u0430\u0445 \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0441\u0445\u0435\u043c\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f dbo)<\/p>\n<p>serverName &#8212; \u0438\u043c\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<p>localSchema &#8212; \u0438\u043c\u044f \u0441\u0445\u0435\u043c\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 pg \u0431\u0430\u0437\u0435 (\u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0434\u0443\u0435\u043c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u043b\u0438\u0431\u043e \u0442\u0440\u0430\u0431\u043b\u0448\u0443\u0442\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0430\u0437.  <\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><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\/ru\/post\/694766\/\"> https:\/\/habr.com\/ru\/post\/694766\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435  <\/h2>\n<p>\u0412 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0431\u044b\u043b\u0430 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 MSSQL (\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435), \u0430 \u0442\u0430\u043a\u0436\u0435 PostgreSQL Pro Enterprise 10.3, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430\u044f \u043d\u0430 CentOS 7 (\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c). \u041d\u0443 \u0438 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a FreeTDS<\/h2>\n<ol>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c freetds \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 (<a href=\"http:\/\/mirrors.ibiblio.org\/freetds\/stable\/freetds-0.91.tar.gz\" rel=\"noopener noreferrer nofollow\">freetds-0.91.tar.gz<\/a>) \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0440\u0443\u0447\u043a\u0430\u043c\u0438 (<a href=\"http:\/\/mirrors.ibiblio.org\/freetds\/stable\/\" rel=\"noopener noreferrer nofollow\">http:\/\/mirrors.ibiblio.org\/freetds\/stable\/<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e WinSCP \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430 postgres \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043b\u044e\u0431\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 (\u0423 \u043c\u0435\u043d\u044f \/home\/myuser\/)<\/p>\n<\/li>\n<li>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 <\/p>\n<p><code>tar -zxvf freetds-0.91.tar.gz<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a: gcc-c++, ncurses-devel<\/p>\n<p>(\u041c\u043e\u0436\u0435\u0442\u0435 \u043a\u0443\u0441\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u043b\u0438\u0447\u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u0435\u0437 \u044d\u0442\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0448\u0430\u0433\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0438 \u0430\u0440\u0445\u0438\u0432\u0430 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e<\/p>\n<p>  <code>cd freetds-0.91\/<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u2014prefix (\u0443 \u043c\u0435\u043d\u044f \/usr\/local\/freetds)  <\/p>\n<p><code>.\/configure --prefix=\/usr\/local\/freetds --enable-msdblib<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<p><code>make &amp;&amp; make install<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0448\u0438\u0431\u043e\u043a. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0433\u0443\u0433\u043b\u0438\u043c, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0440\u0430\u0437\u0443. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 FreeTDS (\u0432 \u043f\u0430\u043f\u043a\u0443 \/usr\/local\/freetds). \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433-\u0444\u0430\u0439\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043b\u0438\u0431\u043e \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u0432 WinSCP<\/p>\n<p><code>vim \/etc\/ld.so.conf<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u0430\u0439\u043b \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0431\u0435\u043b \u043f\u0443\u0442\u044c \u0434\u043e lib \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  (\/usr\/local\/freetds\/lib\/) \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f<\/p>\n<p><code>ldconfig<\/code><\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e PATH \u043f\u0443\u0442\u044c \u0434\u043e bin \u043f\u0430\u043f\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438  <\/p>\n<p><code>PATH=\/usr\/local\/freetds\/bin:$PATH<\/code><\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c tsql \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <\/p>\n<p><code>tsql -C<\/code><\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/p>\n<\/li>\n<li>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e MS \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f) \u0432 freetds.conf \u0444\u0430\u0439\u043b\u0435 (\u0435\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0432\u044b\u0448\u0435)  \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/p>\n<p>[my_server]<br \/> host = serverhost<br \/> port = serverport<br \/> tds version = 7.0<\/p>\n<p>\u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0445\u043e\u0441\u0442 \u0438 \u043f\u043e\u0440\u0442 (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 1433), \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u043c\u044f \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445, \u0434\u0430\u043b\u0435\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f.  <\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435  <\/p>\n<p><code>tsql -S myserver -U username -P password<\/code><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c <\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0440\u043e\u0441. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b <\/p>\n<p><code>SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG='dbName'<\/code><\/p>\n<p>\u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 1> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 2> \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u043e go.<\/p>\n<p>\u0410 \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0439\u0442\u0438\u00a0\u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 MS \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u0438\u0448\u0435\u043c quit \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Enter .<\/p>\n<\/li>\n<\/ol>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 tds_fdw \u043c\u043e\u0434\u0443\u043b\u044f<\/h2>\n<ol>\n<li>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0433\u0438\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u00a0<a href=\"https:\/\/github.com\/tds-fdw\/tds_fdw.git\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/tds-fdw\/tds_fdw.git<\/a><\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u0430\u043a zip-\u0430\u0440\u0445\u0438\u0432 \u0440\u0443\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e WinSCP \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u043d\u0430 pg \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u043b\u044e\u0431\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 (\u0423 \u043c\u0435\u043d\u044f \/home\/myuser\/)<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0430\u0440\u0445\u0438\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p><code>unzip tds_fdw-master.zip<\/code><\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c Makefile \u0444\u0430\u0439\u043b \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c (\u0443 \u043c\u0435\u043d\u044f \/home\/myuser\/tds_fdw-master\/Makefile) <\/p>\n<p>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 SHLIB_LINK \u0438 PG_CPPFLAGS, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0443\u0442\u044c \u0434\u043e \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 freeTDS (\u043f\u0443\u0442\u044c \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0438 \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 6 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430)<\/p>\n<\/li>\n<li>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443  <\/p>\n<p><code>make USE_PGXS=1 install<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041e\u0448\u0438\u0431\u043e\u043a \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e.<\/p>\n<p><em>\u041c\u0438\u043d\u0443\u0442\u043a\u0430 \u0442\u0440\u0430\u0431\u043b\u0448\u0443\u0442\u0438\u043d\u0433\u0430<\/em><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 make: pg_config: Command not found<\/p>\n<p>\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 pg_config \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 WinSCP \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/p>\n<p><code>find \/ -depth -name \"pg_config\"<\/code> <\/p>\n<p>b. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 postgres\\*version\\* -devel-\\* \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439  <\/p>\n<p><code>rpm -qa | grep postgres<\/code> <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0435\u0442, \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c.  \u0412 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u043a\u0430\u0447\u0430\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e rpm \u0440\u0443\u043a\u0430\u043c\u0438, \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<p><code>yum localinstall \/path\/to\/rpm\/package.rpm<\/code><\/p>\n<p>c. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 pg_config \u0444\u0430\u0439\u043b\u0430. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f  <\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0444\u0430\u0439\u043b tds_fdw.so \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <\/p>\n<p> <code>ldd \/path\/to\/file\/tds_fdw.so<\/code><\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u0443\u0442\u044c \u0434\u043e lybsybdb.so.5 \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0415\u0441\u043b\u0438 \u043f\u0443\u0442\u044c \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043b\u0438\u043d\u043a\u0443 \u0432 \u043f\u0430\u043f\u043a\u0443 \/usr\/lib\/ , \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c ldconfig <\/p>\n<p><code>ln -s \/usr\/local\/freetds\/lib\/libsybdb.so.5 \/usr\/lib\/libsybdb.so.5 &amp;&amp; ldconfig<\/code><\/p>\n<p>\u041d\u0410 \u042d\u0422\u041e\u041c \u042d\u0422\u0410\u041f\u0415 \u0420\u0410\u0411\u041e\u0422\u0410 \u0421 \u0421\u0415\u0420\u0412\u0415\u0420\u041e\u041c \u0417\u0410\u0412\u0415\u0420\u0428\u0415\u041d\u0410, \u041f\u0415\u0420\u0415\u0425\u041e\u0414\u0418\u041c \u0412 POSTGRESQL \u041a\u041e\u041d\u0421\u041e\u041b\u042c<\/p>\n<\/li>\n<\/ol>\n<h2>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c<\/h2>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435<\/p>\n<p><code>CREATE EXTENSION tds_fdw;<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u043e\u0441\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 tds_fdw \u043c\u043e\u0434\u0443\u043b\u044c. <\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<p><code>CREATE SERVER serverName FOREIGN DATA WRAPPER tds_fdw  OPTIONS (servername 'serverName_fromFreetdsConf', database 'dbName', msg_handler 'notice');<\/code><\/p>\n<p>serverName &#8212; \u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 sql \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445<\/p>\n<p>serverName_fromFreetdsConf &#8212; \u0438\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u0432 freetds.conf \u0444\u0430\u0439\u043b\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435 1<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440  <\/p>\n<p><code>CREATE USER MAPPING FOR CURRENT_USER SERVER serverName OPTIONS (username 'dbUser', password 'dbUserPswd');<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u0441\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <\/p>\n<p><code>IMPORT FOREIGN SCHEMA dbo FROM SERVER serverName INTO localSchema;<\/code><\/p>\n<p>dbo &#8212; \u0438\u043c\u044f \u0441\u0445\u0435\u043c\u044b \u0438\u0437 MS \u0431\u0430\u0437\u044b (\u0432 MS \u0431\u0430\u0437\u0430\u0445 \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0441\u0445\u0435\u043c\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f dbo)<\/p>\n<p>serverName &#8212; \u0438\u043c\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<p>localSchema &#8212; \u0438\u043c\u044f \u0441\u0445\u0435\u043c\u044b \u0432 \u043d\u0430\u0448\u0435\u0439 pg \u0431\u0430\u0437\u0435 (\u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0434\u0443\u0435\u043c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u043b\u0438\u0431\u043e \u0442\u0440\u0430\u0431\u043b\u0448\u0443\u0442\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0430\u0437.  <\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><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\/ru\/post\/694766\/\"> https:\/\/habr.com\/ru\/post\/694766\/<\/a><br \/><\/br><\/br><\/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-340066","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340066","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=340066"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340066\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}