Skip to content

Bug: [Postgres] QueryBuilder::updateBatch() pg_affected_rows(): Argument #1 ($result) must be of type PgSql\Result, bool given #7387

Closed
@Onerosolutions

Description

@Onerosolutions

PHP Version

8.1

CodeIgniter4 Version

4.3.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

PostgeSQL 15

What happened?

Error after run $this->modelName->updateBatch($updatedData, 'id');

{
    "title": "TypeError",
    "type": "TypeError",
    "code": 500,
    "message": "pg_affected_rows(): Argument #1 ($result) must be of type PgSql\\Result, bool given",
    "file": "D:\\onero\\onero-crm-ci4-api\\vendor\\codeigniter4\\framework\\system\\Database\\Postgre\\Connection.php",
    "line": 172,
    "trace": [
        {
            "file": "D:\\onero\\onero-crm-ci4-api\\vendor\\codeigniter4\\framework\\system\\Database\\Postgre\\Connection.php",
            "line": 172,
            "function": "pg_affected_rows",
            "args": [
                false
            ]
        },
        {
            "file": "D:\\onero\\onero-crm-ci4-api\\vendor\\codeigniter4\\framework\\system\\Database\\BaseBuilder.php",
            "line": 1802,
            "function": "affectedRows",
            "class": "CodeIgniter\\Database\\Postgre\\Connection",
            "type": "->",
            "args": []
        },
        {
            "file": "D:\\onero\\onero-crm-ci4-api\\vendor\\codeigniter4\\framework\\system\\Database\\BaseBuilder.php",
            "line": 2562,
            "function": "batchExecute",
            "class": "CodeIgniter\\Database\\BaseBuilder",
            "type": "->",
            "args": [
                "_updateBatch",
                100
            ]
        },
        {
            "file": "D:\\onero\\onero-crm-ci4-api\\vendor\\codeigniter4\\framework\\system\\Model.php",
            "line": 414,
            "function": "updateBatch",
            "class": "CodeIgniter\\Database\\BaseBuilder",
            "type": "->",
            "args": [
                [
                    {
                        "package_plan_id": "PP63aa9a4a1f221",
                        "package_plan_name": "Basic",
                        "package_plan_description": "The ideal solution for small businesses with an affordable price, easy to use, even for beginners.",
                        "updated_at": "2023-03-27 05:08:21"
                    },
                    {
                        "package_plan_id": "PP63aa9a4a1f252",
                        "package_plan_name": "Business",
                        "package_plan_description": "The perfect package for mid-size companies, various additional features to market, sell & support your business.",
                        "updated_at": "2023-03-27 05:08:21"
                    },
                    {
                        "package_plan_id": "PP63aa9a4a1f26d",
                        "package_plan_name": "Professional",
                        "package_plan_description": "Complete features for complex needs, bring value to customers and create the best user experience.",
                        "updated_at": "2023-03-27 05:08:21"
                    }
                ],
                "package_plan_id",
                100
            ]
        },

Steps to Reproduce

Run updateBatch method
$this->modelName->updateBatch($updatedData, 'id');

Expected Output

No error.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix themdatabaseIssues or pull requests that affect the database layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions