Skip to content

Commit

Permalink
use a shorter example for upserts
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 27, 2018
1 parent 24a8d69 commit ca501cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions lib/Mojo/Pg/Database.pm
Expand Up @@ -371,11 +371,9 @@ As well as some PostgreSQL specific extensions added by L<SQL::Abstract::Pg>.
Including operations commonly referred to as C<upsert>.
# "insert into some_table (foo) values ('bar')
# on conflict (foo) do update set foo = 'baz'"
$db->insert('some_table', {foo => 'bar'}, {
on_conflict => \['(foo) do update set foo = ?', 'baz']
});
# "insert into t (a) values ('b') on conflict (a) do update set a = 'c'"
$db->insert(
't', {a => 'b'}, {on_conflict => \['(a) do update set a = ?', 'c']});
=head2 insert_p
Expand Down
8 changes: 3 additions & 5 deletions lib/SQL/Abstract/Pg.pm
Expand Up @@ -119,11 +119,9 @@ array reference references to pass literal SQL with bind values are supported.
This includes operations commonly referred to as C<upsert>.
# "insert into some_table (foo) values ('bar')
# on conflict (foo) do update set foo = 'baz'"
$abstract->insert('some_table', {foo => 'bar'}, {
on_conflict => \['(foo) do update set foo = ?', 'baz']
});
# "insert into t (a) values ('b') on conflict (a) do update set a = 'c'"
$abstract->insert(
't', {a => 'b'}, {on_conflict => \['(a) do update set a = ?', 'c']});
=head1 SELECT
Expand Down

0 comments on commit ca501cb

Please sign in to comment.