Home > database >  Use dblink times wrong
Use dblink times wrong

Time:10-07

Using dblink across the library operation, an error don't know why, please comment, due to the original machine cannot be connected to the Internet, I met problems, for example to describe my
Machine A: IP: 192.168.0.1, psql9.4
Machine B: IP: 192.168.0.2, psql9.5

In the two machines built respectively
The create table test_t1 (id integer, name text);
In two machine install the expansion pack dblink
In machine b PSQL:
The select dblink_connect (' con ', 'hostaddr=192.168.0.1 port=5432 user=postgres passwd=123456 dbname=postgres');
This step is no problem,

Perform
The select dblink_exec (' con ', 'insert into test_t1 (1,' 234 ') ');
No problem, according to insert a line,

Perform
The select dblink_exec (' con ', 'insert into test_t1 (1,' ABC ') ');
Will be displayed error, near the ABC syntax errors,

CodePudding user response:

refer to the original poster shockqjq response:
using dblink across the library operation, an error don't know why, please comment, due to the original machine cannot be connected to the Internet, I met, for example, to describe my question,
Machine A: IP: 192.168.0.1, psql9.4
Machine B: IP: 192.168.0.2, psql9.5

In the two machines built respectively
The create table test_t1 (id integer, name text);
In two machine install the expansion pack dblink
In machine b PSQL:
The select dblink_connect (' con ', 'hostaddr=192.168.0.1 port=5432 user=postgres passwd=123456 dbname=postgres');
This step is no problem,

Perform
The select dblink_exec (' con ', 'insert into test_t1 (1,' 234 ') ');
No problem, according to insert a line,

Perform
The select dblink_exec (' con ', 'insert into test_t1 (1,' ABC ') ');
Will be displayed error, near the ABC syntax errors,


Single quotation marks in front of ABC and the single quotation marks in front of the insert constitute a pair of, behind,
So here is modified to double quotation marks,
  • Related