Comments (3)
The first column must be unique, I think that is missing in the
documentation. I will add that in the documentation.
Actually postgres_fdw is using ctid to identify the unique column for
DELETE and UPDATE which does not exists in mysql, so I am using the first
column for that purpose. Some other fdw are using the same technique.
I am thinking to add an option to specify a key column (which must be
unique) while creating a foreign table, instead of using the first column.
On Tue, Mar 3, 2015 at 8:49 PM, Radim Blazek [email protected]
wrote:
PostgreSQL 9.3, MySQL 5.5, mysql_fdw ddd5344
ddd5344MySQL:
CREATE TABLE foo (
a int,
b int,
c varchar(3)
);
INSERT INTO foo VALUES ( 1, 1, 'aaa');
INSERT INTO foo VALUES ( 1, 2, 'bbb');PostgreSQL:
CREATE FOREIGN TABLE foo ( a int, b int, c varchar(44) )
SERVER mysql_server OPTIONS (dbname 'test', table_name 'foo');
UPDATE foo set c = 'zzz' WHERE b = 2;
SELECT * FROM foo;
a | b | c
---+---+-----
1 | 1 | zzz
1 | 2 | zzzI.e. all rows were updated (very dangerous IMO). Works OK if values in 'a'
(the first column) are unique or if the first column is not included in the
foreign table.BTW, probably not related directly to this issue, but there are also some
strange skips over the first column here
https://github.com/EnterpriseDB/mysql_fdw/blob/e03bc73/mysql_fdw.c#L943
https://github.com/EnterpriseDB/mysql_fdw/blob/e03bc73/mysql_fdw.c#L1244—
Reply to this email directly or view it on GitHub
#45.
Ibrar Ahmed
EnterpriseDB http://www.enterprisedb.com
from mysql_fdw.
If the first column must be unique, it should be checked when the foreign table is created and it should raise an error if it is not unique.
It should be probably also checked again when an UPDATE is executed because the table in mysql could change since foreign table was created.
from mysql_fdw.
Agreed, I will add these checks, thanks for reporting.
On Tue, Mar 3, 2015 at 9:55 PM, Radim Blazek [email protected]
wrote:
If the first column must be unique, it should be checked when the foreign
table is created and it should raise an error if it is not unique.It should be probably also checked again when an UPDATE is executed
because the table in mysql could change since foreign table was created.—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Ibrar Ahmed
EnterpriseDB http://www.enterprisedb.com
from mysql_fdw.
Related Issues (20)
- Getting error while installing pgvector extension to PostgreSQL in windows using the pgvector source repository HOT 3
- During push-down insert, the precision of numeric type fields is lost. HOT 1
- MySQL type YEAR is not supported HOT 4
- trigger not firing on foreign table HOT 9
- How can I Disable PREPARED-STATEMENT for SELECT statement? HOT 1
- IMPORT FOREIGN SCHEMA not importing mixed case tables HOT 6
- ERROR: failed to load the mysql query: (null) HINT: Export LD_LIBRARY_PATH to locate the library in PostgreSQL 16 on Rocky Linux 8 HOT 9
- Segmentation fault w/ dual left join is null HOT 4
- [Feature request] Support Subquery pushdown
- Truncating casts are not pushed down correctly HOT 2
- bytes after ` `(0x02 0x01 0x00) get truncated in column with type `text`
- cannot `UPDATE` or `DELETE` on fdw foreign table that inherits pgsql table HOT 1
- Unable to install the extension HOT 7
- Trouble downloading mysql_fdw
- Import Schema should convert/map MySQL tinyint(1) to PG boolean. HOT 2
- Unable to install the extensions HOT 5
- make: *** No targets specified and no makefile found. Stop. HOT 2
- create extensions failed HOT 1
- PostgreSQL 17 support HOT 4
- mysql_fwd cannot connect from PG16 to mysql HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql_fdw.