Questions tagged [array]
The array tag has no usage guidance.
316
questions
11
votes
1
answer
7k
views
PostgreSQL PREPARE query with IN () parameters
I'm trying to prepare a query from PHP like:
pg_prepare($con, "prep", "select * from test where tid in ($1)");
and then execute it with:
$strpar = "3,4,6,8,10";
pg_execute($con, "prep", array($...
1
vote
0
answers
259
views
Is there are way to use Fine Grain Auditing to record Varray bind values?
I have an application, and would like to use Oracle's FGA (Fine Grained-Auditing) to record varray bind information. Specifically, I am using Oracle Spatial and need to know at what extent users are ...
134
votes
8
answers
431k
views
How to turn JSON array into Postgres array?
I have a column data of type json that holds JSON documents like this:
{
"name": "foo",
"tags": ["foo", "bar"]
}
I would like to turn the nested tags array into a concatenated string ('foo, ...
0
votes
2
answers
726
views
Cycle or something similar in PL/SQL
Quite often it is necessary to do some repetetive operations / few line queries against set of objects. Let's say you have a list of accounts to unlock via
alter user %username% account unlock
and ...
1
vote
0
answers
2k
views
storing arrays or images in a database table
I'm a beginner with both database design and use of forums such as this one so forgive me if I forget to provide some relevant information below.
Basically I'm trying to store a set of arrays, in ...
1
vote
2
answers
2k
views
Dealing with data stored as arrays in a MySQL DB
So I know storing arrays in a DB field is wrong and would never do it myself, however a 3rd party plugin my company is using stores data in an array and I was wondering if you could help me try to ...
6
votes
1
answer
7k
views
Transpose two-dimensional array from n rows to 2 columns
Background
Using PostgreSQL 9.1, so WITH ORDINAL (a 9.4 feature) is not available.
Problem
Looking to simplify the code that pivots a two-dimensional array.
Code
A working, overly-verbose example ...
1
vote
1
answer
3k
views
Pass a table array as a parameter to an upsert function in postgresql
i have an UPSERT function which works well but i update and insert records in batches, can this function be modified so that i just pass all the records to this function as an array then it will ...
1
vote
0
answers
607
views
Checking of one specific element of one array is in another array?
Suppose I have two arrays. One looking like (3, 9, 10, 39), and one looking like (4, 10, 9, 48, 391, 2).
How would I (through pure MySQL) check if one of the elements in the first array is inside the ...
4
votes
1
answer
11k
views
Selecting with varbinary(max) criteria (in the where clause)
Basic info
Database: SQL Server Express 2008 R2
Client: SQL Server Management Studio
Backround (skip if not interested):
A project I'm maintaining uses an ORM, which apparently stored my enum ...
9
votes
3
answers
10k
views
How to pass a table type with an array field to a function in postgresql
i have a table called book
CREATE TABLE book
(
id smallint NOT NULL DEFAULT 0,
bname text,
btype text,
bprices numeric(11,2)[],
CONSTRAINT key PRIMARY KEY (id )
)
and a ...
5
votes
2
answers
11k
views
ERROR: could not find array type for datatype information_schema.sql_identifier
I am trying to run the below sql command:
SELECT ARRAY(
SELECT column_name
FROM information_schema.columns
WHERE table_name ='gis_field_configuration_stage'
);
and I get the below ...
5
votes
1
answer
584
views
Postgresql - Internal Array handling - array type or pointer type
I have a question, about the internal handling of array columns in Postgres.
Does the engine handle it as a classical array with memory alloc or is it somehow a pointer list.
It would be interesting ...
25
votes
1
answer
25k
views
How to preserve the original order of elements in an unnested array?
Given the string:
'I think that PostgreSQL is nifty'
I would like to operate on the individual words found within that string. Essentially, I have a separate from which I can get word details and ...
5
votes
1
answer
267
views
Retrieve Indices of Associative Array as Collection
In PL/SQL, suppose I have some associative array defined as follows:
declare
type a_arr_t is table of PLS_INTEGER index by PLS_INTEGER;
a_arr a_arr_t;
I then, sparsely, populate the ...
17
votes
1
answer
60k
views
Pass an array or record to a function in PostgreSQL?
I have a task to pass arrays, records, and in some cases array of records as a parameter to functions in PostgreSQL.