官术网_书友最值得收藏!

Importing data using psql

Psql is the pgsql's command-line tool. While one can achieve quite a lot with GUI based database management utilities, psql is very useful when one needs to handle database backups, management and alike via scripting. When there is no GUI installed on the server, psql becomes pretty much the only option so it is worth being familiar with it even if you're not a fan.

In order to import the data in psql we will use a \COPY command. This requires us to define the data model for the incoming data first.

Defining the table data model from a text file may be prone to errors that will prevent data from being imported. If for of some reason you are not sure what data types are stored in the particular columns of your source file you can import all the data as text and then re-cast it as required at a later time.

主站蜘蛛池模板: 皋兰县| 黑河市| 上饶市| 长春市| 海淀区| 清水县| 沙洋县| 城步| 寿光市| 河东区| 西华县| 阜宁县| 楚雄市| 大连市| 南召县| 临夏市| 西安市| 盐山县| 定陶县| 城口县| 泽普县| 东乌| 沧州市| 威海市| 扶绥县| 德昌县| 盐亭县| 宜城市| 舟山市| 辽源市| 锦州市| 信阳市| 正蓝旗| 久治县| 台山市| 湖州市| 马公市| 慈利县| 晋江市| 黎城县| 永州市|