Re: [GENERAL] JSON output

2010-09-13 Thread Dennis Gearon
No, don't need all the set stuff, just the result of either: 1/ A SELECT * from a view that is a query, 2/ Or the result of the same query. Seems like it'd take a lot of horsepower to: A/ Do the query B/ Convert it to XML C/ Convert it to JSON D/ Then insert it into ElasticSearch.

Re: [GENERAL] Incrementally Updated Backups

2010-09-13 Thread Joshua D. Drake
On Sun, 2010-09-12 at 12:18 +0200, J. Roeleveld wrote: On Sunday 12 September 2010 00:43:19 Bruce Momjian wrote: Gabe Nell wrote: That section has been removed from the current 9.0 docs because we are unsure it works. Hmm. So the only way to make a consistent backup from a

[GENERAL] Server crash during simple c-language function

2010-09-13 Thread Tomáš Kovářík
Hi, I am trying to create a simple c-language function for PostgreSQL 8.4.4, compiled by Visual C++ build 1400, 32-bit running on Windows 7 (32-bit). It works, until I use a SPI. 1) CRASH: I successfully execute a simple query using SPI_exec(), but when getting the result, it crashes:

Re: [GENERAL] Incrementally Updated Backups

2010-09-13 Thread Mikko Partio
I'm interested in the incrementally updated backups scenario described in section 25.6 of the Postgres 9 documentation. I've configured streaming replication for my warm standby server. Step 2 in this procedure is to note?pg_last_xlog_replay_location at the end of the backup. However

Re: [GENERAL] Monitoring Object access

2010-09-13 Thread adi hirschtein
Thanks! I'll look into those system tools and probably come back with some more questions... Best, Adi On Mon, Sep 13, 2010 at 4:58 AM, Craig Ringer cr...@postnewspapers.com.auwrote: On 09/12/2010 10:02 PM, adi hirschtein wrote: Hi Craig, Thanks a lot for the quick response! I'm coming

Re: [GENERAL] Incrementally Updated Backups

2010-09-13 Thread Scott Marlowe
On Mon, Sep 13, 2010 at 1:29 AM, Mikko Partio mpar...@gmail.com wrote: I'm interested in the incrementally updated backups scenario described in section 25.6 of the Postgres 9 documentation. I've configured streaming replication for my warm standby server. Step 2 in this procedure is to

Re: [GENERAL] Query plan choice issue

2010-09-13 Thread Yaroslav Tykhiy
Hi Martin, Thank you for your response! On 13/09/2010, at 10:49 AM, Martin Gainty wrote: a cursory look of the plan details a FTS on dbmail_headername invoked by the JOIN clause JOIN dbmail_headername n ON v.headername_id=n.id you would accelerate the seek appreciably by placing indexes on

Re: [GENERAL] Incrementally Updated Backups

2010-09-13 Thread Mikko Partio
That section has been removed from the current 9.0 docs because we are unsure it works. Is the feature (or the documentation) still being worked on, or is pg_dump the only way to take a backup of a warm standby while the database is running? I don't think you can take a pg_dump of

[GENERAL] new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

2010-09-13 Thread MailingLists
Dear all of you, I'm currently working on a centos that I manage with webmin. A sI try to create a DB with unicode encoding the following message is returned to me : new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) After a little

Re: [GENERAL] new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

2010-09-13 Thread Craig Ringer
On 13/09/10 19:48, MailingLists wrote: Dear all of you, I'm currently working on a centos that I manage with webmin. A sI try to create a DB with unicode encoding the following message is returned to me : new encoding (UTF8) is incompatible with the encoding of the

Re: [GENERAL] User function canceling VACUUMDB utility

2010-09-13 Thread Carlos Henrique Reimer
Hi, Yes, once correct schema was included in the search_path, VACUUM and ANALYZE run fine again. Thank you! On Fri, Sep 10, 2010 at 11:38 AM, Tom Lane t...@sss.pgh.pa.us wrote: Carlos Henrique Reimer carlos.rei...@opendb.com.br writes: Yes, you're right! I found out a functional index using

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Sam Mason
On Fri, Sep 10, 2010 at 01:23:39PM -0700, bjjjrn lundin wrote: I usually do like this on a new box sudo su - su - postgres createuser bnl exit exit It would be somewhat easier to use sudo's -u switch, the following should do the same as the above: sudo -u postgres createuser $USER --

Re: [GENERAL] How to inherit search_path from template

2010-09-13 Thread Merlin Moncure
On Sun, Sep 12, 2010 at 8:34 AM, Scott Marlowe scott.marl...@gmail.com wrote: On Thu, Sep 9, 2010 at 7:41 PM, Merlin Moncure mmonc...@gmail.com wrote: On Thu, Sep 9, 2010 at 7:13 AM, Phui Hock phuih...@gmail.com wrote: Hi, How can I create a database template with altered search_path to be

Re: [GENERAL] Is there a bug in FOR i IN 1..10 LOOP (8.4.4)?

2010-09-13 Thread Rob Richardson
What makes you think there is a bug? What does this function return for you? It always helps us to see everything you have seen. Without taking the time to try it on my system, I'd recommend explictly converting your index to text: num_var := num_var || ',' || i::text; RobR -- Sent via

Re: [GENERAL] Incrementally Updated Backups

2010-09-13 Thread RB
On Sep 12, 2:39 pm, jo...@antarean.org (J. Roeleveld) wrote: On Sunday 12 September 2010 13:32:00 Martijn van Oosterhout wrote: On Sun, Sep 12, 2010 at 12:18:10PM +0200, J. Roeleveld wrote: How can you ensure the snapshot is in a consistent state if the server is running? If a

Re: [GENERAL] Query plan choice issue

2010-09-13 Thread Tom Lane
Yaroslav Tykhiy y...@barnet.com.au writes: - Bitmap Heap Scan on dbmail_headervalue v (cost=1409.82..221813.70 rows=2805 width=16) (actual time=28543.411..28623.623 rows=1 loops=1) Recheck Cond: (v.headername_id = n.id)

Re: [GENERAL] User function canceling VACUUMDB utility

2010-09-13 Thread Tom Lane
Carlos Henrique Reimer carlos.rei...@opendb.com.br writes: Yes, once correct schema was included in the search_path, VACUUM and ANALYZE run fine again. You'd be better advised to fix the function so it works regardless of caller's search_path. As-is, it's a loaded gun pointed at your foot.

Re: [GENERAL] Good candidate query for window syntax?

2010-09-13 Thread Dimitri Fontaine
Ketema Harris ket...@gmail.com writes: My goal is: To find the maximum number of concurrent rows over an arbitrary interval. My guess is that the following would help you: http://wiki.postgresql.org/wiki/Range_aggregation -- dim -- Sent via pgsql-general mailing list

Re: [GENERAL] Monitoring Object access

2010-09-13 Thread Greg Smith
adi hirschtein wrote: Using the catalog tables, is there any way to correlate session id/user id to which object (i.e. tables, indexes etc) it access and much how disk reads or I/O wait has been done against the objects. in general, I'd like to see which objects are being accessed by which

[GENERAL] I keep getting type does not exist on compile of this SETOF function (list 2 table)

2010-09-13 Thread Jonathan Brinkman
[CODE] BEGIN; DROP TYPE structure.format_list2table_rs CASCADE; CREATE TYPE structure.format_list2table_rs AS ( item VARCHAR(4000) ); END; CREATE OR REPLACE FUNCTION structure.format_list2table ( v_list varchar, v_delim varchar ) RETURNS SETOF structure.format_list2table_rs AS $body$ /*

Re: [GENERAL] I keep getting type does not exist on compile of this SETOF function (list 2 table)

2010-09-13 Thread Merlin Moncure
On Mon, Sep 13, 2010 at 11:17 AM, Jonathan Brinkman jonathanbrink...@yahoo.com wrote: [CODE] BEGIN; DROP TYPE structure.format_list2table_rs CASCADE; CREATE TYPE structure.format_list2table_rs AS (  item VARCHAR(4000) ); END; CREATE OR REPLACE FUNCTION structure.format_list2table (  

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Carlos Mennens
Thanks for all the assistance and clarification with my new install of PostgreSQL. I am able to switch users to 'postgres' and verify the default home directory for 'postgres' shell user: [r...@db1 ~]# su - postgres [postg...@db1 ~]$ pwd /var/lib/postgres I am also now able from the

Re: [GENERAL] hi, how to let the inserted tuple visible to other backend when current backend hasn't finish?

2010-09-13 Thread Merlin Moncure
On Sun, Sep 12, 2010 at 3:02 AM, sunpeng blueva...@gmail.com wrote: hi, These codes are in the postgresql engine, just assume they are in PortalRun() function: //1.create table structure char *relname = test; ... relOid = heap_create_with_catalog(relname, ); CommandCounterIncrement();

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Tom Lane
Carlos Mennens carlos.menn...@gmail.com writes: In MySQL, it was recommended that you create a power user account rather than manage the database with the 'root' account. Is this also the same thing for PostgreSQL? I know you guys told me that there is no 'root' account but there is a

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Carlos Mennens
On Mon, Sep 13, 2010 at 1:57 PM, Tom Lane t...@sss.pgh.pa.us wrote: It's definitely a good idea not to use a superuser account when you don't have to; just like you don't use Unix root unless you have to. You should do your day-to-day database hacking in an ordinary unprivileged account. When

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Scott Marlowe
On Mon, Sep 13, 2010 at 12:24 PM, Carlos Mennens carlos.menn...@gmail.com wrote: On Mon, Sep 13, 2010 at 1:57 PM, Tom Lane t...@sss.pgh.pa.us wrote: I also noticed that I created a database called 'ide' in PostgreSQL as the 'postgres' super user and I am trying to change the owner of the

Re: [GENERAL] Schema search path

2010-09-13 Thread Bruce Momjian
Yaroslav Tykhiy wrote: Hi there, Sorry but I've got yet another issue to discuss today, this time that on schema search path. In fact it may not be a bug, but it may be worth a note in the documentation. It seems that if the table in SELECT FROM has an explicit schema specifier,

Re: [GENERAL] Schema search path

2010-09-13 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: Yaroslav Tykhiy wrote: SELECT * FROM foo.bar WHERE bar.a=1; ^^^ this means foo.bar Do you think it's a feature or a bug? :-) Feature, and SQL-standard behavior. It might be worth pointing out that this has nothing to do

[GENERAL] Any plans to expose publicly (via stored proc) relation_needs_vacanalyze, or some flavour of do_autovacuum?

2010-09-13 Thread Vlad Romascanu
Imagine the following sequence of events: 1. a writer session begins a transaction, growing the number of live tuples in several tables (e.g. via COPY) from mere tens (or hundreds) to tens of thousands of tuples, then COMMITs 2. one or more reader sessions perform a SELECT ... JOIN on the very

Re: [GENERAL] Schema search path

2010-09-13 Thread Yaroslav Tykhiy
On 14/09/2010, at 8:56 AM, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: Yaroslav Tykhiy wrote: SELECT * FROM foo.bar WHERE bar.a=1; ^^^ this means foo.bar Do you think it's a feature or a bug? :-) Feature, and SQL-standard behavior. It might be

Re: [GENERAL] Query plan choice issue

2010-09-13 Thread Yaroslav Tykhiy
Hi Tom, On 14/09/2010, at 12:41 AM, Tom Lane wrote: Yaroslav Tykhiy y...@barnet.com.au writes: - Bitmap Heap Scan on dbmail_headervalue v (cost=1409.82..221813.70 rows=2805 width=16) (actual time=28543.411..28623.623 rows=1 loops=1) Recheck

Re: [GENERAL] Any plans to expose publicly (via stored proc) relation_needs_vacanalyze, or some flavour of do_autovacuum?

2010-09-13 Thread Tom Lane
Vlad Romascanu vromasc...@accurev.com writes: The logical, amended solution would then be to have the writer session perform, after INSERTion but before COMMITTing, the same calculation that the autovacuum daemon currently performs inside relation_needs_vacanalyze, based on the same

Re: [GENERAL] Post Install / Secure PostgreSQL

2010-09-13 Thread Craig Ringer
On 14/09/2010 1:57 AM, Tom Lane wrote: I'd suggest creating carlos as either a plain user or a CREATEROLE user depending on whether you think you're likely to be adding/deleting plain users regularly. I'd second that. When I install a new instance of PostgreSQL, I usually set up a craig user

Re: [GENERAL] Help! pg_dump: Error message from server: ERROR: cache lookup failed for type 19

2010-09-13 Thread Craig Ringer
On 14/09/2010 11:02 AM, 夏武 wrote: I reconvery it by \copy command. thanks very much. Glad to help. In future, it might be a good idea to: - Keep regular pg_dump backups; and - Avoid trying to alter the system catalogs With Slony you can never completely avoid needing to mess with the