Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-26 Thread Adarsh Sharma
Able to fix but still new error :( test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$# DECLARE test$# stmt text; test$# abc varchar; test$# BEGIN test$# select to_char(NEW.a::timestamp,'mmdd') into abc ; test$# stmt := 'insert into tmp'||abc|| '

[GENERAL] Re: [HACKERS] Frontend/backend protocol improvements proposal (request).

2013-06-26 Thread Albe Laurenz
Dmitriy Igrishin wrote: I understand the problem now. I pondered a bit over your design, and I came up with a different idea how to represent prepared statements in a C++ library. First, a prepared statement is identified by its name. To make the relationship between a PreparedStatement

Re: [GENERAL] utf8 errors

2013-06-26 Thread Albe Laurenz
Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte sequence for encoding UTF8: 0x9c But the query is clean ascii and it doesn't even contain the mentioned

[GENERAL] array_agg and partition sorts

2013-06-26 Thread Rory Campbell-Lange
I'm on Postgres 9.1 and I've come across an issue which shows I don't understand partition sorting: Given a table like this: select * from test; n_group | t_name| t_additional -+-+-- 1 | Canberra| Australia 1 | Vienna

Re: [GENERAL] utf8 errors

2013-06-26 Thread Jiří Pavlovský
On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte sequence for encoding UTF8: 0x9c But the query is clean ascii and

Re: [GENERAL] utf8 errors

2013-06-26 Thread Jiří Pavlovský
On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte sequence for encoding UTF8: 0x9c But the query is clean ascii and

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-26 Thread Sameer Thakur
Do you think that it is important to do so? Are you experiencing problems which you believe are due to missing/out of date activity statistics? Or is this more for curiosity? I am making specifications for a tool which captures query plan statistics. I wanted its behavior to be the same

Re: [GENERAL] Concatenate table name in Pl/Pgsql

2013-06-26 Thread Adarsh Sharma
Final Fix : execute 'insert into tmp'||abc|| ' select $1.*' using new; Thanks On Wed, Jun 26, 2013 at 12:18 PM, Adarsh Sharma eddy.ada...@gmail.comwrote: Able to fix but still new error :( test=# CREATE OR REPLACE FUNCTION tmp_trigger_function() test-# RETURNS TRIGGER AS $$ test$#

Re: [GENERAL] utf8 errors

2013-06-26 Thread Alban Hertroys
On 26 June 2013 11:17, Jiří Pavlovský j...@pavlovsky.eu wrote: On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte

Re: [GENERAL] utf8 errors

2013-06-26 Thread Jiří Pavlovský
On 26.6.2013 12:19, Alban Hertroys wrote: On 26 June 2013 11:17, Jiří Pavlovský j...@pavlovsky.eu mailto:j...@pavlovsky.eu wrote: On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID,

Re: [GENERAL] utf8 errors

2013-06-26 Thread Alban Hertroys
On 26 June 2013 12:39, Jiří Pavlovský j...@pavlovsky.eu wrote: On 26.6.2013 12:19, Alban Hertroys wrote: On 26 June 2013 11:17, Jiří Pavlovský j...@pavlovsky.eu wrote: On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT

Re: [GENERAL] utf8 errors

2013-06-26 Thread Jiří Pavlovský
On 26.6.2013 13:32, Alban Hertroys wrote: On 26 June 2013 12:39, Jiří Pavlovský j...@pavlovsky.eu mailto:j...@pavlovsky.eu wrote: On 26.6.2013 12:19, Alban Hertroys wrote: On 26 June 2013 11:17, Jiří Pavlovský j...@pavlovsky.eu mailto:j...@pavlovsky.eu wrote: On

Re: [GENERAL] utf8 errors

2013-06-26 Thread Albe Laurenz
Jirí Pavlovský wrote: I'm getting these errors on tables as well. Actually when I copy and paste the offending queries from log into pgAdmin it runs without an error. So the queries work from pgadmin; what application/environment are they NOT working in? Something is obviously different.

[GENERAL] dynamic partitioning

2013-06-26 Thread dafNi zaf
Hello! I want to dynamically create partition tables that inherit a main table called foo. The creation must occur when needed. For example, lets say that I want to insert 10 entries and I want 5 partition tables (with 2 entries each). So, first I need a partition for the first 2

Re: [GENERAL] dynamic partitioning

2013-06-26 Thread dafNi zaf
one note: I create a table of 100 entries in order to test it so I want 5 partition of 20 entries each. (And not a table of 10 entries) thanks again! dafni On Wed, Jun 26, 2013 at 4:47 PM, dafNi zaf dza...@gmail.com wrote: Hello! I want to dynamically create partition tables that

Re: [GENERAL] dynamic partitioning

2013-06-26 Thread Daniel Cristian Cruz
You forgot to set the trigger on foo: CREATE TRIGGER foo_insert BEFORE INSERT ON foo FOR EACH ROW EXECUTE PROCEDURE foo_insert_trigger(); 2013/6/26 dafNi zaf dza...@gmail.com one note: I create a table of 100 entries in order to test it so I want 5 partition of 20 entries each.

Re: [GENERAL] dynamic partitioning

2013-06-26 Thread AI Rumman
Yes, you missed the trigger part. And also you will get error like below during insert: INSERT INTO foo VALUES (99, 109, 109, 99, '2013-06-26 16:38:58.466'); NOTICE: table_name = (foo_100_to_119) NOTICE: CREATE TABLE foo_100_to_119 (CHECK ( foo_id = 100 AND foo_id = 119 )) INHERITS (foo) ERROR:

Re: [GENERAL] utf8 errors

2013-06-26 Thread Tom Lane
Albe Laurenz laurenz.a...@wien.gv.at writes: Once you can reproduce the problem, try a network trace on the communication between cleint and server. Maybe that helps to solve the problem. Actually, if you can reproduce the problem on demand, try attaching to the backend process with gdb and

Re: [GENERAL] utf8 errors

2013-06-26 Thread Jiří Pavlovský
On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte sequence for encoding UTF8: 0x9c But the query is clean ascii and

[GENERAL] Semi-Pseudo Data Types Procedure Arguments

2013-06-26 Thread Joshua Burns
Has anyone played around with what I would call Semi-Pseudo Data Types, in which a stored procedure may accept a sub-set of a Pseudo Data Types but not just any pseudo data-type, such as any type of string (text, character varying, character), any type of integer (smallint, integer, bigint), or a

Re: [GENERAL] dynamic partitioning

2013-06-26 Thread AI Rumman
That because you are generating table name from from_value which is distinct everytime. Like, INSERT INTO foo VALUES (1, 11, 11, 1, '2013-06-26 16:38:58.466'); NOTICE: table_name = (foo_1_to_21) NOTICE: CREATE TABLE foo_1_to_21 (CHECK ( foo_id = 1 AND foo_id = 21 )) INHERITS (foo) INSERT 0 0

Re: [GENERAL] utf8 errors

2013-06-26 Thread Alban Hertroys
On 26 June 2013 11:03, Jiří Pavlovský jir...@gmail.com wrote: On 26.6.2013 10:58, Albe Laurenz wrote: Jirí Pavlovský wrote: I have a win32 application. LOG: statement: INSERT INTO recipients (DealID, Contactid) VALUES (29009, 9387) ERROR: invalid byte

[GENERAL] Need help compiling from souce

2013-06-26 Thread Jake Silverman
I'm trying to compile pg 9.3 beta 1 from source using microsoft visual studio on a computer running windows 7. When I build I run into around 1600 errors and around 36 warnings. I imagine I'm doing something horribly wrong. The following is the start of my error log: http://pastebin.com/PdGdvWT7

Re: [GENERAL] dynamic partitioning

2013-06-26 Thread dafNi zaf
I solved the problem with the error! thank you very much! But there is still 1 issue: when I insert multiple rows (for exaple with the attachment in my fist email) it creates 100 partition tables that contain 1 entry instead of 5 partitions with 20 entries.. Any ideas in that?? Thanks again!

Re: [GENERAL] Semi-Pseudo Data Types Procedure Arguments

2013-06-26 Thread Karsten Hilbert
On Wed, Jun 26, 2013 at 01:50:46AM -0400, Joshua Burns wrote: Example #1: -- A stored procedure which can accept two arguments, each of which could be text, character varying, character varying(any length) or character(any length). SELECT * FROM my_fn('val1'::text, 'val2'::character(4));

Re: [GENERAL] array_agg and partition sorts

2013-06-26 Thread Rory Campbell-Lange
On 26/06/13, Rory Campbell-Lange (r...@campbell-lange.net) wrote: I'm on Postgres 9.1 and I've come across an issue which shows I don't understand partition sorting: Returns: -[ RECORD 1 ]- agg1

Re: [GENERAL] Semi-Pseudo Data Types Procedure Arguments

2013-06-26 Thread Tom Lane
Joshua Burns jdbu...@gmail.com writes: Has anyone played around with what I would call Semi-Pseudo Data Types, in which a stored procedure may accept a sub-set of a Pseudo Data Types but not just any pseudo data-type, such as any type of string (text, character varying, character), any type of

Re: [GENERAL] Need help compiling from souce

2013-06-26 Thread Tom Lane
Jake Silverman jakerosss...@gmail.com writes: I'm trying to compile pg 9.3 beta 1 from source using microsoft visual studio on a computer running windows 7. When I build I run into around 1600 errors and around 36 warnings. I imagine I'm doing something horribly wrong. The following is the

Re: [GENERAL] Semi-Pseudo Data Types Procedure Arguments

2013-06-26 Thread David Johnston
Tom Lane-2 wrote -- A stored procedure which can accept two argument, which can be a single integer field, or an array of integers. Those two cases seem unlikely to be supportable by the same implementation, so it seems more likely that what you'd be doing is just overloading the

Re: [GENERAL] Semi-Pseudo Data Types Procedure Arguments

2013-06-26 Thread David Johnston
David Johnston wrote Tom Lane-2 wrote -- A stored procedure which can accept two argument, which can be a single integer field, or an array of integers. Those two cases seem unlikely to be supportable by the same implementation, so it seems more likely that what you'd be doing is just

[GENERAL] Problem with at_askml function in Postgis

2013-06-26 Thread Hall, Samuel L (Sam)
Using PostgreSQL 9.1.8 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit POSTGIS=2.0.1 r9979 GEOS=3.3.3-CAPI-1.7.4 PROJ=Rel. 4.8.0, 6 March 2012 GDAL=GDAL 1.9.2, released 2012/10/08 LIBXML=2.8.0 LIBJSON=UNKNOWN TOPOLOGY RASTER Postgis seems to be

Re: [GENERAL] Problem with at_askml function in Postgis

2013-06-26 Thread Tom Lane
Hall, Samuel L (Sam) sam.h...@alcatel-lucent.com writes: I get this error ERROR: function st_askml(geometry) is not unique LINE 1: select st_askml(path) from paths where jobnumber = '20121491... ^ HINT: Could not choose a best candidate function. You might need to add

Re: [GENERAL] [HACKERS] Frontend/backend protocol improvements proposal (request).

2013-06-26 Thread Dmitriy Igrishin
2013/6/26 Albe Laurenz laurenz.a...@wien.gv.at Dmitriy Igrishin wrote: I understand the problem now. I pondered a bit over your design, and I came up with a different idea how to represent prepared statements in a C++ library. First, a prepared statement is identified by its name. To

Re: [GENERAL] Need help compiling from souce

2013-06-26 Thread Jake Silverman
Sorry about that, and thanks for taking the time to help me. Here is the full file: https://www.dropbox.com/s/c4dwf47nob0i7fr/file4.txt -Jake (Just realized I didn't hit reply all. I'm sorry for sending you this message twice.) On Wed, Jun 26, 2013 at 11:29 AM, Tom Lane t...@sss.pgh.pa.us

[GENERAL] unique constraint violations

2013-06-26 Thread pg noob
Hi all, There are some places in our application where unique constraint violations are difficult to avoid due to multithreading. What we've done in most places to handle this is to retry in a loop. Generally it starts by checking if a value already exists, if not - try to insert it, which may

Re: [GENERAL] unique constraint violations

2013-06-26 Thread Steven Schlansker
On Jun 26, 2013, at 11:04 AM, pg noob pgn...@gmail.com wrote: Hi all, There are some places in our application where unique constraint violations are difficult to avoid due to multithreading. What we've done in most places to handle this is to retry in a loop. Generally it starts by

Re: [GENERAL] unique constraint violations

2013-06-26 Thread pg noob
Thank you for the suggestion Steven. Originally I did implement a solution using savepoints and that worked as a way to keep all the work done on the transaction leading up to the constraint violation, but errors would still show up in the Postgres log. With this new function approach there are no

[GENERAL] installer woes, 9.1 on windows 2008 R2

2013-06-26 Thread John R Pierce
trying to install 9.1.9 64bit on a win2008 r2 server and getting a failure of the initdb phase, with no clue why. I've installed the application on C:\postgresql\9.1\ and the data on D:\postgresql\9.1\data ... after the first try, I added the LOCAL\postgres user to the permissions on the

Re: [GENERAL] installer woes, 9.1 on windows 2008 R2

2013-06-26 Thread Igor Neyman
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce Sent: Wednesday, June 26, 2013 3:38 PM To: PostgreSQL Subject: [GENERAL] installer woes, 9.1 on windows 2008 R2 trying to install 9.1.9 64bit on a win2008 r2 server and getting a

Re: [GENERAL] installer woes, 9.1 on windows 2008 R2

2013-06-26 Thread John R Pierce
On 6/26/2013 12:49 PM, Igor Neyman wrote: Look for bitrock_installer.log in the \Users\account_you_are_using\AppData\Local\Temp. Or just do search for bitrock_installer.log file. ahhh. two weirdnesses below... A) why is it using 'myusername' (the account I ran the installer from)

Re: [GENERAL] Need help compiling from souce

2013-06-26 Thread Tom Lane
Jake Silverman jakerosss...@gmail.com writes: Sorry about that, and thanks for taking the time to help me. Here is the full file: https://www.dropbox.com/s/c4dwf47nob0i7fr/file4.txt [ lots and lots of error C2065: 'BLCKSZ' : undeclared identifier error C2065: 'XLOG_SEG_SIZE' : undeclared

[GENERAL] convert from json to text[]

2013-06-26 Thread Mason Leung
Hi, I am running postgres 9.2.4 and 1 of my columns (column name is old_field) is type json. When I select from this table, I get the following sample data select old_field from table1; [], ['a', 'b'] ['a'] [] How do I change the data type from json to text[]? I have tried alter table

Re: [GENERAL] convert from json to text[]

2013-06-26 Thread Merlin Moncure
On Wed, Jun 26, 2013 at 8:34 PM, Mason Leung h2op...@gmail.com wrote: Hi, I am running postgres 9.2.4 and 1 of my columns (column name is old_field) is type json. When I select from this table, I get the following sample data select old_field from table1; [], ['a', 'b'] ['a'] [] How