Is it possible to query the "INSERT INTO table SET field = 'value'" in PostgreSQL?

2

It is possible to execute the query INSERT INTO nome_tabela SET nome_campo = 'aaaa' in the PostgreSQL database.

I needed to migrate a virtual store made in PHP with MySQL , to PostgreSQL .

The part of the bank migration I got with the help of a program and worked.

Fortunately the old programmer used PDO to program, which has helped me a lot, but many INSERT queries are written the way I described here.

I'm using version 10.

    
asked by anonymous 29.12.2017 / 04:52

1 answer

4

Not possible.

This is one of the problems of doing something non-standard.

In fact this is a great demonstration that migrating a database used by an application is not trivial and does not work automatically.

Unfortunately the biggest problems are not so visible and they cause huge problems without being noticed right away and people tend to think it's something else, even blaming DB, and someone will always argue that they should not have migrated because it proved worse than was "sold".

Unfortunately PDO was used. His only real advantage is an illusion. Migrating from database involves a total reassessment of the semantics of data access. The PDO only helps a bit in the syntax which is the easy part. Therefore the PDO helps less 10%, probably much less, in the migration. But the most tragic is that it gives the illusion that helped close or 100%, which is not true.

If it causes few problems, it's because it was bad before.

An ORM can have the same or worse effect. ORM is useful in some scenarios, but database swapping is an illusion. In fact it is worse because it tends to leave bad access always, a layer like the PDO, if done right, can be good and would only look bad in case of migration.

Here we always see questions talking about these things and the person thinks he will "push a button" and everything will be resolved. Architecture problems are the hardest to solve and unfortunately few people know how to do architecture, most believe in things that have no basis in engineering, only marketing.

So when the person uses the PDO and uses syntax that can not be migrated, the person did not know what he was doing. If the person did wrong in the syntax, which is the easy part, imagine in the semantics.

    
29.12.2017 / 11:39