S
S
Sergey Shevchenko2016-12-15 23:53:46
PostgreSQL
Sergey Shevchenko, 2016-12-15 23:53:46

Postgresql checking single value for emptiness in array?

Can anyone tell me how to check in this array

{
    {elem1},
    {elem2},
    {elem3},
    ...
}

check for emptiness {elem1}
there are gps coordinates of the form {dd.d+, dd.d+}
and maybe instead of {54.83, 37.11342} be
{
    {},
    {elem2},
    {elem3},
    ...
}

(and this is not necessary)
and perhaps even nothing at all (neither elem1, nor elem2 .... nor the main array itself, where all these elements lie)
NULL
SELECT
    map_points
FROM table
WHERE
    вот что тут писать?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Shevchenko, 2016-12-15
@lancer_serega

2dc34d28555f4ce49100fe2a6989711e.png
Did so. (crutch)

array_to_string("map_points"[1:1], '{') AS "gps",
                array_to_string("map_points"[2:2], '{') AS "name",

only in php had to cut out the closing curly braces
$offer['name'] = preg_replace('/[\{\}]/', ' ', $offer['name']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question