Andi Klapper wrote:
sql = "("INSERT INTO table1 (field1, field2, field3)
VALUES ('abc', 'abc', TRUE),
('def', 'def', FALSE),
('ghi', 'ghi', TRUE");"
pypl.execute(sql)
.
.
$$
LANGUAGE 'plpythonu' VOLATILE
I ran into trouble with quoting this
I have a table, which has a creation_ts (timestamp) column, but does not
have a id (serial) column. I want to add such a one, but, AFAIK, if I enter
ALTER TABLE table ADD COLUMN id serial
it will randomly put the sequence numbers.
I wrote a function, which uses a cursor and UPDATE WHERE CURRENT
n PL/Proxy to remove the sequence from the argument list and to
call the sequence generator?
Is there a better way to do that?
Thanks in advance,
Igor Katson.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.or
Thom Brown wrote:
I would like to see what's in a function. I can do this if I use
pgAdmin III just by clicking on the function, and it appears in the
SQL pane opposite. But how is this done? Is there a command like
DESCRIBE FUNCTION logging.do_stuff; ? And if possible, doing this
without
I want to DROP CASCADE a table, but I am afraid that amoung numerous
recursive dependencies there will be smth, that I don't want to drop.
Is there a way to watch all dependencies recursively without doing a drop?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make cha
Thom Brown wrote:
I would like to see what's in a function. I can do this if I use
pgAdmin III just by clicking on the function, and it appears in the
SQL pane opposite. But how is this done? Is there a command like
DESCRIBE FUNCTION logging.do_stuff; ? And if possible, doing this
without
Is there a way to get i.e. table creation sql script from an existing
table in psql (not postgresql, but psql client), like it is in pgAdmin?
I.e. i point it to existing table 'foo', and it writes:
CREATE TABLE foo (
bar int
);
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.
Grzegorz Jaśkiewicz wrote:
pg_dump -t foo database
Thanks, but pg_dump is not psql client (i meant the */bin/psql
interactive shell), and there is only an option for table objects, and
no one for i.e. indices.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make ch
Grzegorz Jaśkiewicz wrote:
pg_dump -t ANYOBJECT database
afaik., try it - play with it.
that does not work for indices. But the index creation is shown when
placing it's parent table into -t. Thanks for the help, Grzegorz, the
issue is solved.
--
Sent via pgsql-general mailing list (pgsq
Richard Huxton wrote:
Igor Katson wrote:
I want to DROP CASCADE a table, but I am afraid that amoung numerous
recursive dependencies there will be smth, that I don't want to drop.
Is there a way to watch all dependencies recursively without doing a drop?
BEGIN;
DROP CA
vidual, which are in a given group. That
seems ok without plproxy, but with using it, I can't imagine how can I
form a nice query, or a function (or a set of plpgsql + plproxy
functions) to do the job.
Thanks in advance and regards,
Igor Katson.
--
Sent via pgsql-general mailing list
Hannu Krosing wrote:
On Thu, 2009-01-22 at 02:33 +0300, Igor Katson wrote:
So to say, give me the list of friends (not only their ID's, but all the
needed columns!) of given individual, which are in a given group. That
seems ok without plproxy, but with using it, I can't imagine
Marko Kreen wrote:
On 1/22/09, Igor Katson wrote:
Hannu Krosing wrote:
> On Thu, 2009-01-22 at 02:33 +0300, Igor Katson wrote:
>
>
>> So to say, give me the list of friends (not only their ID's, but all the
>> needed columns!) of given individual, which
Hannu Krosing wrote:
On Thu, 2009-01-22 at 15:10 +0300, Igor Katson wrote:
Ok, thank you, guys. What is the best way to make an array out of a
column? I didn't make up anything better then writing a function:
CREATE OR REPLACE FUNCTION int_column_to_array(query text) RETURNS int[
Hannu Krosing wrote:
On Thu, 2009-01-22 at 16:13 +0200, Hannu Krosing wrote:
On Thu, 2009-01-22 at 15:10 +0300, Igor Katson wrote:
Ok, thank you, guys. What is the best way to make an array out of a
column? I didn't make up anything better then writing a function:
CREATE OR RE
statement will be removed, so if it was not written.
I think, this is a common problem.
Thanks in advance and regards,
Igor Katson.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Raymond O'Donnell wrote:
On 23/01/2009 11:16, Igor Katson wrote:
How do I write a function without complex logic, which will do:
a) If the input argument is NULL, then the corresponding select
statement will change from
column = arg
to
column IS NULL
You could build your stat
Sam Mason wrote:
On Fri, Jan 23, 2009 at 02:16:34PM +0300, Igor Katson wrote:
a) If the input argument is NULL, then the corresponding select
statement will change from
column = arg
to
column IS NULL
I think you want to use the IS [NOT] DISTINCT FROM operator. It
works like the
Michael Glaesemann wrote:
On Jan 23, 2009, at 10:11 , Igor Katson wrote:
That one is awesome, thanks, I completely forgot about CASE
statement. The search func now looks as follows, and works perfectly:
CREATE OR REPLACE FUNCTION isocial_user_func.search_users
(i_city_id int, i_edu_id int
FROM isocial_user_func.get_users_from_array(arr) a,
>>friend_func.get_friends_short(i_user_id,
limit_, offset_) b
WHERE a.id = b.friend_id
LOOP
RETURN NEXT rec;
END LOOP;
RETURN;
END;
$$ language plpgsql;
Regards,
Ig
postgres' full-text search capabilities?
2. Does anyone know, if there is a Russian dictionary of these names?
3. What is the name of such kind of dictionary, to know, what to google for?
Thanks in advance, and regards
Igor Katson.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.or
Oleg Bartunov wrote:
On Thu, 29 Jan 2009, Igor Katson wrote:
I have a column, containing the name of the user and there is a need
to organize an indexed search on this column. As far as I understand,
I need to use the full-text search capabilities of postgres.
I would like to attach a
As far as I understand, it is a known problem of using plproxy, that it
cannot be rolled back if used inside transactions. But I need something
similar to this functionality.
I have some data, that is duplicated across the DB partitions, and to be
exact, there is i.e. a plproxy-partitioned DB,
Hannu Krosing wrote:
On Fri, 2009-01-30 at 14:09 +0300, Igor Katson wrote:
As far as I understand, it is a known problem of using plproxy, that it
cannot be rolled back if used inside transactions. But I need something
similar to this functionality.
I have some data, that is duplicated
Oleg Bartunov wrote:
On Tue, 3 Feb 2009, Igor Katson wrote:
On my question about doing a first name search by it's synonyms, like
William Will Bill Billy
James Jim Jimmy
Oleg answered, that I can use dict_xsyn for that.
In the dict_xsyn manual, it is said that:
"This dicti
Oleg Bartunov wrote:
I contacted with author of dict_xsyn, so probably, he'll add option to
support what you want.
Thanks for cooperation, Oleg. By now, I will use that workaround.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http:/
On my question about doing a first name search by it's synonyms, like
William Will Bill Billy
James Jim Jimmy
Oleg answered, that I can use dict_xsyn for that.
In the dict_xsyn manual, it is said that:
"This dictionary type replaces words with groups of their synonyms, and
so makes it
possibl
I am doing an ALTER TABLE to create a foreign key, however with some
rows i get:
insert or update on table "name" violates foreign key constraint "name_fkey"
How can I just drop the conflicting rows while doing that?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make
Craig Ringer wrote:
Richard Huxton wrote:
DELETE FROM table1 WHERE col1 NOT IN (SELECT id from table2);
Just as a side note: If you have a large number of missing IDs and don't
want to wait a long time, you may be better off with something like
(untested, but I think it's right - TEST
I would like to call several plproxy functions one after another (which
will call plpgsql functions in different target partitions), and in case
one of them fails, i want to roll back changes in every one.
That is exactly how two-phase-commit (2PC) should work.
As far as I understand, the post
I need to execute a rather complex plpgsql function on a production
server, the result of which is hard to test by myself.
I want to make the result of a transaction, in which this function is
executed, visible to the outer clients, but to have the ability of
making a rollback in case one of t
Jeff Davis wrote:
On Wed, 2009-02-11 at 12:43 +0300, Igor Katson wrote:
ERROR: XX000: SPI_execute_plan failed executing query "PREPARE
TRANSACTION '2pctest'": SPI_ERROR_TRANSACTION
It's probably treating the word PREPARE specially. You can avoid this
pro
Jeff Davis wrote:
On Thu, 2009-02-12 at 00:57 +0300, Igor Katson wrote:
Thanks, Jeff. That's not good news, cause I am not able to do that.
There may be some creative solution, but I don't know plproxy well
enough to suggest one.
The postgres manual says, that
&quo
For each element in the array, I need to make some operation with plpgsql.
I usually use the syntax:
DECLARE
array_len int;
BEGIN
array_len := array_upper(i_array, 1);
FOR i IN 1 .. array_len
LOOP
SOME OPERATION (i_array[i])
END LOOP;
But I don't like that. Is there any built-in way to
A. Kretschmer wrote:
In response to Igor Katson :
I think I need a built-in function to make a column from an array, like
in the backwards operation SELECT ARRAY(column)
By David Fetter:
CREATE OR REPLACE FUNCTION unnest(ANYARRAY) RETURNS SETOF ANYELEMENT
LANGUAGE SQL AS $$SELECT $1
Is there any kind of a parallel psql client, to control a cluster of
databases, without the need to write a plproxy function for each request?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-gene
36 matches
Mail list logo