top-think / top-think/think-orm

pgsql.sql在新版本(pg版本大于10)报pg_attrdef.adsrc不存在的解决办法

Open
#359 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

PostgreSQL
Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

原因

pg_attrdef.adsrc在pg版本大于10后已经被取消了,这个字段不存在了。

解决办法

将pgsql.sql的61行:

pg_attrdef.adsrc AS fields_default,

更换为:

pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid) AS fields_default,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open pgsql.sql and inspect line 61, where the PostgreSQL column default is read. Check the compatibility difference between PostgreSQL versions before and after 10, then verify the query works on a PostgreSQL version above 10. Done means the ORM can read column defaults without referencing the removed field.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgresql
Domain
databases
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.