Skip to content

Issue with using "sticky" option with Postgresql driver and read/write connections. #32966

@nesh-ua

Description

@nesh-ua
  • Laravel Version: 7.4.3
  • PHP Version: 7.12.0
  • Database Driver & Version: PostgreSQL 12

Description:

I have 2 connection with db (read/write). Also i set "sticky" option as true. After creating new row all request to DB use "read" connection. After updating some row, there are not any problem. This problem is happened when table has auto increment.

Steps To Reproduce:

//create some row.
$quest = factory(Quest::class)->create();
// update this row. if i remove comment for next lines, everything work alright. Because update was made. But when we make only create, selection works via "read" connection.
//$quest->limit_winners = random_int(1, 200);
//$quest->update();
// find this row. (use read connection), but if i understood right have to use write connection, because new row was created.
$quest = Quest::query()->where('id', $quest->id)->first();
print_r($quest);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions