PG::UndefinedTable: ERROR: 관계 "pg_range"이(가) 존재하지 않습니다

여기 있는 가이드를 따르고 있습니다:

bundle exec rake db:create를 실행하면 오류가 발생하며 다음과 같은 메시지가 표시됩니다:

[Warning] Discourse recommends developing using Ruby v3.1.3 or above. You are using v2.7.6.
PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
Couldn't create 'discourse_development' database. Please check your configuration.
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

어떻게 해야 합니까?
WSL 2와 Ubuntu 18.04.5를 사용 중이며 PostgreSQL 버전은 9.2입니다.

정말 오래된 버전입니다.

요즘에는 13.x 버전을 실행하고 있어야 합니다.

좋아요, 업그레이드를 시도해 보겠습니다.

문제의 원인이 정확히 뭔지는 모르겠지만, 분명히 더 호환성이 좋아질 거예요 :slight_smile:

지금 이 오류가 발생합니다:

[Warning] Discourse recommends developing using Ruby v3.1.3 or above. You are using v2.7.6.
PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
Couldn't create 'discourse_development' database. Please check your configuration.
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "pg_range" does not exist
LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid
                  ^
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

https://stackoverflow.com/a/57765806

해당 SO 링크에 따르면, 데이터베이스가 오래되었거나 손상된 것입니다.

그럼 새로운 것을 어떻게 만들어야 할까요? 저는 PostgreSQL을 사용해 본 적이 없습니다.

음, 이제 다른 오류가 발생하고 있습니다:

[Warning] Discourse recommends developing using Ruby v3.1.3 or above. You are using v2.7.6.
We could not find your database: postgres. Which can be found in the database configuration file located at config/database.yml.

To resolve this issue:

- Did you create the database for this app, or delete it? You may need to create your database.
- Has the database name changed? Check your database.yml config has the correct database name.

To create your database, run:

        bin/rails db:create
Couldn't create 'discourse_development' database. Please check your configuration.
rake aborted!
ActiveRecord::NoDatabaseError: We could not find your database: postgres. Which can be found in the database configuration file located at config/database.yml.

To resolve this issue:

- Did you create the database for this app, or delete it? You may need to create your database.
- Has the database name changed? Check your database.yml config has the correct database name.

To create your database, run:

        bin/rails db:create
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'

Caused by:
PG::ConnectionBad: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/home/joecooldoo/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

그래서 이 가이드를 따르기로 결정했습니다:

“migrating database” 메시지 이후에 이 오류가 발생합니다:

Migrating database...
rake aborted!
Discourse::Utils::CommandError: /src/lib/discourse.rb:134:in `exec': mkdir: cannot create directory ‘/src/public/plugins/’: Permission denied
/src/lib/discourse.rb:168:in `execute_command'
/src/lib/discourse.rb:134:in `exec'
/src/lib/discourse.rb:30:in `execute_command'
/src/lib/plugin/instance.rb:727:in `activate!'
/src/lib/discourse.rb:337:in `block in activate_plugins!'
/src/lib/discourse.rb:334:in `each'
/src/lib/discourse.rb:334:in `activate_plugins!'
/src/config/application.rb:216:in `block in <class:Application>'
/src/lib/plugin.rb:6:in `initialization_guard'
/src/config/application.rb:216:in `<class:Application>'
/src/config/application.rb:75:in `<module:Discourse>'
/src/config/application.rb:74:in `<main>'
/home/discourse/.bundle/gems/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/home/discourse/.bundle/gems/ruby/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/src/Rakefile:7:in `<main>'
(See full trace by running task with --trace)

여전히 문제가 발생하고 있는데, 해결 방법이 있을까요?