暂无图片
pg_bulkload安装出错
我来答
分享
暂无图片 匿名用户
pg_bulkload安装出错


[postgres@test_dan bulk_test]$ psql -U postgres -d testdb -f /opt/pgbinary/pgsql/share/postgresql/extension/pg_bulkload.sql
BEGIN
CREATE SCHEMA
psql.bin:/opt/pgbinary/pgsql/share/postgresql/extension/pg_bulkload.sql:23: ERROR: could not access file "$libdir/pg_bulkload": 没有那个文件或目录
ROLLBACK

请问这个错误如何处理?

[root@test_dan lib]# more /opt/pgbinary/pgsql/share/postgresql/extension/pg_bulkload.sql
/*
* pg_bulkload.sql
*
* Copyright (c) 2007-2020, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
*/

-- Adjust this setting to control where the objects get created.
BEGIN;

CREATE SCHEMA pgbulkload;

CREATE FUNCTION pgbulkload.pg_bulkload(
IN options text[],
OUT skip bigint,
OUT count bigint,
OUT parse_errors bigint,
OUT duplicate_new bigint,
OUT duplicate_old bigint,
OUT system_time float8,
OUT user_time float8,
OUT duration float8
)
AS '$libdir/pg_bulkload', 'pg_bulkload' LANGUAGE C VOLATILE STRICT;

COMMIT;

我来答
添加附件
收藏
分享
问题补充
5条回答
默认
最新
严少安
暂无图片

看报错应该是$libdir未指定,先看下echo $libdir的输出是什么

暂无图片 评论
暂无图片 有用 0
nanjing_2013
2022-03-08
echo $libdir 结果是空,不知道正确的应该是什么值
nanjing_2013

echo $libdir的输出空

请问正确的应该是什么位置

暂无图片 评论
暂无图片 有用 0
董小姐
暂无图片

不执行这个语句
create extension pg_bulkload; #如果连接指定到单个库时,需要创建扩展以生成
pgbulkload.pg_bulkload() 函数
postgres-# \df pgbulkload.*
List of functions
Schema | Name | Result data type | Argument data types
| Type
------------±------------±-----------------±-------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------±-----
pgbulkload | pg_bulkload | record | options text[], OUT skip bigint, OUT count bigint, OUT parse_errors bigint, OUT duplicate_new bigint, OUT duplicate_old b
igint, OUT system_time double precision, OUT user_time double precision, OUT duration double precision | func
(1 row)
创建扩展后模式和函数就都创建了

暂无图片 评论
暂无图片 有用 0
董小姐
暂无图片

[postgres@localhost extension]$ whereis pg_bulkload
pg_bulkload: /data/pgdb/pgsql/bin/pg_bulkload

暂无图片 评论
暂无图片 有用 0
董小姐
暂无图片

[postgres@localhost extension]$ more /data/pgdb/pgsql/share/extension/pg_bulkload–3.1.20.sql
/*

  • pg_bulkload–3.1.20.sql
  • Copyright © 2007-2023, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
    */

– complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use “CREATE EXTENSION pg_bulkload” to load this file. \quit

CREATE SCHEMA pgbulkload;

– Adjust this setting to control where the objects get created.
CREATE FUNCTION pgbulkload.pg_bulkload(
IN options text[],
OUT skip bigint,
OUT count bigint,
OUT parse_errors bigint,
OUT duplicate_new bigint,
OUT duplicate_old bigint,
OUT system_time float8,
OUT user_time float8,
OUT duration float8
)
AS ’libdir/pgbulkload,pgbulkloadLANGUAGECVOLATILESTRICT;[postgres@localhostextension]libdir/pg_bulkload', 'pg_bulkload' LANGUAGE C VOLATILE STRICT; [postgres@localhost extension] echo $libdir

[postgres@localhost extension]$ whereis pg_bulkload
pg_bulkload: /data/pgdb/pgsql/bin/pg_bulkload
知道路径在哪里了吧

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏