Project

General

Profile

Bug #4972

array PHP <-> Pg conversion is broken

Added by Álvaro Herrera over 16 years ago. Updated about 11 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Element parsing in arrays can easily be confused. Test case:

create or replace function another_text_test(text[], int)
returns text language plphp as $$ return $argsr0[$argsr1]; $$;

Strings should be quoted before passing them to PHP, so the NOTICE from PHP here is bogus:

pl_regression=# select another_text_test($${"foo",'bar', "{"}$$, 0);
NOTICE:  plphp: Use of undefined constant foo - assumed 'foo'
 another_text_test 
-------------------
 foo
(1 fila)

The same reason causes this to "eat" the inner level of quotes:

pl_regression=# select another_text_test($${"'bar'", "{"}$$, 0);
 another_text_test 
-------------------
 bar
(1 fila)

Note particularly this totally unexpected behavior:

pl_regression=# select another_text_test($${"'bar'", "{"}$$, 1);
 another_text_test 
-------------------
 array(
(1 fila)
#1

Updated by Álvaro Herrera over 14 years ago

  • Status changed from New to In Progress
#2

Updated by Álvaro Herrera over 12 years ago

  • Assignee deleted (Álvaro Herrera)
#3

Updated by Álvaro Herrera about 11 years ago

  • Priority changed from Low to Normal

Also available in: Atom PDF