dousongqiang2585 2016-11-25 06:28
浏览 36

错误“没有功能匹配。 。 “与PostgreSQL的Laravel交易

I using laravel 5.3 with PostgreSQL and i have code like this

public function store(array $request)
{
    DB::transaction(function () use ($request) {
        $phoneData = [
            'phone_no' => $request['phone'],
            'created_by' => $request['sdm_employee_id'],
            'updated_by' => $request['sdm_employee_id'],
            'created_stamp' => Carbon::now()->toDateString(),
            'updated_stamp' => Carbon::now()->toDateString(),
        ];

        $phone = DonorPhone::create($phoneData);
        if (!$phone) {
            throw new \Exception('Phone not created for account');
        }

        $data = [
            'phone_id' => $phone->id,
            'full_name' => $request['name'],
            'address' => $request['address'],
            'email' => array_key_exists('email', $request) ? $request['email'] : null,
            'register_date' => Carbon::now()->toDateString(),
            'marketer_id' => (int) $request['sdm_employee_id'],
            'created_by' => (int) $request['sdm_employee_id'],
            'updated_by' => (int) $request['sdm_employee_id'],
            'company_id' => 2,
            'user_status' => 1,
            'note' => 'Add donor from sales track apps',
            'phone_no_full' => $request['phone'],
            'created_stamp' => Carbon::now()->toDateString(),
            'updated_stamp' => Carbon::now()->toDateString(),
        ];

        $contact = self::create($data);
        if (!$contact) {
            throw new \Exception('Contact not created');
        }

        $phone->user_id = (int)$contact->id;
        $phone->save();

        $target = new Target;
        $target->updateAchievement($data['sdm_employee_id'], $this->tragetType, Carbon::now()->year, Carbon::now()->month);

        throw new \Exception('Contact not created');
    });
}

When create contact i got error

SQLSTATE[42883]: Undefined function: 7 ERROR:  function php_donor_phone_get_all(integer) does not exist
LINE 1: SELECT php_donor_phone_get_all(NEW.id)
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT php_donor_phone_get_all(NEW.id)
CONTEXT:  PL\/pgSQL function public.php_donor_tr_full_text() line 6 at assignment (SQL: insert into \"public\".\"php_donor_personal\" (\"full_name\", \"address\", \"email\", \"register_date\", \"marketer_id\", \"created_by\", \"updated_by\", \"company_id\", \"user_status\", \"phone_no_full\", \"created_stamp\", \"updated_stamp\") values . . .

I check for function php_donor_phone_get_all is exist and my database username have a grant to execute this function. This seems to relate to a specific data type when calling the function, passing not an integer, but I do not know how to ensure that data in passing is an integer. There is a hint for me? Please help.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算