Without having tried it, I would assume that 'returning' and 'on_conflict' both should be in %options?
my $results = $db->insert($table, \@values || \%fieldvals, \%options); /Lars On Sat, 29 Sep 2018 at 14:22, Jan Eskilsson <[email protected]> wrote: > Hi All > > Using Mojo <https://mojolicious.org/perldoc/Mojo> :: Pg > <https://mojolicious.org/perldoc/Mojo/Pg> :: Database > <https://mojolicious.org/perldoc/Mojo/Pg/Database> latest version 4.10 I > don't get anything from the returning clause even though records are > created or exists in the stockitems table. Instead I get this error : > DBD::Pg::st fetchrow_hashref failed: no statement executing at ... > site/lib/Mojo/Pg/Results.pm line 22. > > Am I doing something wrong or am I correct in assuming this construct not > supported ? > > my $stockitem = $db->insert('stockitems', { > stockitem => @{$payload}[$i]->{PostID}, > description => @{$payload}[$i]->{Position}, > payload => $payload_json, > companies_fkey => $companies_pkey > },{on_conflict => [ > ['stockitem', 'companies_fkey'] => {moddatetime => $now}]}, > {returning => ['stockitems_pkey']}); > > my $stockitems_pkey = $stockitem->hash->{stockitems_pkey}; > > Thank you in advance ! > > > Best Regards > Jan > -- > Titles mean nothing. The one with a servant's heart is the leader. > > Please consider the environment before you print this email. > > All incoming and outgoing emails and any attachments are subjected to a > virus scanner and are believed to be free of any virus, or any other defect > which might affect any computer or IT system into which they are received > and opened. Therefore, it is the responsibility of the recipient to ensure > that they are virus free and no responsibility is accepted by Jan Eskilsson > for any loss or damage arising in any way from receipt or use thereof. > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
