Skip to content

Instantly share code, notes, and snippets.

@2colours
Created January 4, 2023 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2colours/f241c399857b3eb73db97d510bf72b6a to your computer and use it in GitHub Desktop.
Save 2colours/f241c399857b3eb73db97d510bf72b6a to your computer and use it in GitHub Desktop.
Ambiguous call to 'encode-to-text(Protocol::Postgres::Type::Default: Str)'; these signatures all match:
(Protocol::Postgres::Type::Default: Str(Any:D) $input, *%_)
(Protocol::Postgres::Type::Default: Str(Any:D) $input, *%_)
in method encode at /opt/homebrew/Cellar/rakudo-star/2022.12/share/perl6/site/sources/4ABF3661E73A0A176F3A6DC0D272BA3FF21FF959 (Protocol::Postgres) line 780
in sub type-encode at /opt/homebrew/Cellar/rakudo-star/2022.12/share/perl6/site/sources/4ABF3661E73A0A176F3A6DC0D272BA3FF21FF959 (Protocol::Postgres) line 792
in method execute-prepared at /opt/homebrew/Cellar/rakudo-star/2022.12/share/perl6/site/sources/4ABF3661E73A0A176F3A6DC0D272BA3FF21FF959 (Protocol::Postgres) line 1386
in method execute at /opt/homebrew/Cellar/rakudo-star/2022.12/share/perl6/site/sources/4ABF3661E73A0A176F3A6DC0D272BA3FF21FF959 (Protocol::Postgres) line 1150
in sub MAIN at ./ncsp-changelog line 41
in block <unit> at ./ncsp-changelog line 3
my $pg = await Net::Postgres::Connection.connect-tcp(:$user, :$password, :$database);
my $sql = qq:to/SQL/;
SELECT id,
code as {@headers[0]},
names->>'et' as {@headers[1]},
names->>'en' as {@headers[2]},
lower(valid) as {@headers[3]},
upper(valid) as {@headers[4]}
FROM some.table
WHERE code = \$1
SQL
my $prepared-statement = await $pg.prepare($sql, :name<q1>, :input-types[Str]);
my $code = "AAA00";
my $result = await $prepared-statement.execute($code);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment