0

Now I have a problem when use dblink postgres in Laravel query

My query in postgres like that

$query = "SELECT * FROM dblink('host=localhost user=postgres password=123@123a dbname=shbbank',
'SELECT contract_ref_no,currency_iso,report_date FROM bigq.credit_data') 
AS source(contract_ref_no text,currency_iso text,report_date date)"

And then I do that query in Laravel

DB::select($query);

I got error:

Undefined function: 7 ERROR: function dblink(unknown, unknown) does not exist. You might need to add explicit type casts.

Please help me to resolve

Igor Cova
  • 3,126
  • 4
  • 31
  • 57

1 Answers1

0

It seems that extension dblink has not been created.

Try running script create extension dblink via migration or directly on your database. Once you have created the extension, you can use dblink from the right schema.

Thomas Berger
  • 1,860
  • 13
  • 26
user10128333
  • 156
  • 4