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

2013-06-24 Thread Albe Laurenz
I'm moving this discussion to -general. Dmitriy Igrishin wrote: While developing a C++ client library for Postgres I felt lack of extra information in command tags in the CommandComplete (B) message [...] for the following commands: It seems like bad design to me to keep a list of prepared

Re: [GENERAL] missing FROM-clause in version 9.2

2013-06-24 Thread Albe Laurenz
Arun P.L wrote: Getting an error in version 9.2 ERROR: missing FROM-clause entry for table for some queries. Server parameter add_missing_from is removed from version 9 as per release notes, so is there any workaround for fixing this issue? or is the better way is modifying all these

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Albe Laurenz
sachin kotwal wrote: While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. TO_CHAR() in DB2 which can take three arguments as follows: SELECT TO_CHAR(CURRENT_DATE,'-MM-DD',112.50) FROM SYSIBM.SYSDUMMY1 I am not sure what is the

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-18 Thread Albe Laurenz
Stefan Drees wrote: On 2013-06-17 22:17 +02:00, Andrea Lombardoni wrote: I observed the following behaviour (I tested the following statements in 9.0.4, 9.0.5 and 9.3beta1): $ psql template1 template1=# SELECT CASE WHEN 0=0 THEN 0 ELSE 1/0 END; case -- 0 (1 row) template1=#

Re: [GENERAL] JDBC prepared statement is not treated as prepared statement

2013-06-18 Thread Albe Laurenz
高健 wrote: I change my Java program by adding the following: org.postgresql.PGStatement pgt = (org.postgresql.PGStatement)pst; pgt.setPrepareThreshold(1); I can see an entry is in pg_prepared_statements now. Good. But the hyperlink's documentation made me a little confused. I also wonder

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-18 Thread Albe Laurenz
Andrea Lombardoni wrote: It gets even stranger: template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/(select 0) END; case -- 0 (1 row) Here it seems that the ELSE does not get evaluated (which is correct). Yes, of course, because both subselects will not get evaluated at

Re: [GENERAL] JDBC prepared statement is not treated as prepared statement

2013-06-17 Thread Albe Laurenz
高健 wrote: I have one question about prepared statement. I use Java via JDBC, then send prepared statement to execute. I thought that the pg_prepared_statments view will have one record after my execution. But I can't find. Is the JDBC's prepared statement differ from SQL execute by

Re: [GENERAL] prepared statement functioning range

2013-06-14 Thread Albe Laurenz
高健 wrote: Prepared statement is only for use in the same session at which it has been executed. It can not be shared via multiple sessions. That is correct, see http://www.postgresql.org/docs/current/static/sql-prepare.html That is, when in some special situations , if I have to use

Re: [GENERAL] Calculate a quotient for a count of boolean values (true or false)

2013-06-11 Thread Albe Laurenz
Alexander Farber wrote: In a PostgreSQL 8.4.13 why doesn't this please deliver a floating value (a quotient between 0 and 1): select id, count(nullif(nice, false)) - count(nullif(nice, true)) / count(nice) as rating from pref_rep where nice is not null

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Albe Laurenz
Gustavo Amarilla Santacruz wrote: In the PostgreSQL documentation I found currval: Return the value most recently obtained by nextval for this sequence in the current session In other documentations (pgpool, for example), I found Connection Pooling pgpool-II saves connections to the

Re: [GENERAL] PostgreSQL Synchronous Replication in production

2013-06-07 Thread Albe Laurenz
Colin Sloss wrote: I have been testing the differences between asynchronous and synchronous hot standby streaming replication on PostgreSQL 9.2.4. There is some push towards synchronous replication, but I am finding some serious problems, and wonder how other people deal with them.

Re: [GENERAL] Streaming replication with sync slave, but disconnects due to missing WAL segments

2013-06-05 Thread Albe Laurenz
Jeff Janes wrote: On Tue, Jun 4, 2013 at 6:25 AM, mads.tand...@schneider-electric.com wrote: I have a question about sync streaming replication. I have 2 postgresql 9.1 servers set up with streaming replication. On the master node the slave is configured as a synchronous standby. I've

Re: [GENERAL] Synonyms in PostgreSQL 9.2.4

2013-06-05 Thread Albe Laurenz
Panneerselvam Posangu wrote: I am currently working on a conversion project. We plan to make our application PostgreSQL compliant. And for this we have chosen PosgreSQL 9.2.4. Currently our application works along with Oracle 11g. In Oracle schema we have created Synonyms. The context is

Re: [GENERAL] Foreign Data Wrapper out of memory

2013-05-31 Thread Albe Laurenz
Adeelusman wrote: i have recently started work with PostgreSQL. Here is my question! i have a table in oracle and i want to insert all record in PostgreSQL, For this i'm using Foreign Data Wrapper for oracle. it work fine with small set of data but as i tried to get large table query got

Re: [GENERAL] Slow query and using wrong index, how to fix? Probably naive question..

2013-05-22 Thread Albe Laurenz
Antonio Goméz Soto wrote: I am using postgresql 8.1 (CentOS5). I have the following table: system # \d history Table public.history Column | Type | Modifiers

Re: [GENERAL] How to convert numbers into words in postgresql

2013-05-15 Thread Albe Laurenz
Jashaswee wrote: i want to convert numbers into words in postgresql.is there any query for it? if yes please reply soon I found two solutions in the Wiki: http://wiki.postgresql.org/wiki/Integer_to_Text http://wiki.postgresql.org/wiki/Numeric_to_English Yours, Laurenz Albe -- Sent via

Re: [GENERAL] question on most efficient way to increment a column

2013-05-08 Thread Albe Laurenz
Tyson Maly wrote: If I have a simple table with an id as a primary key that is a serial column and a column to keep track of a total_count for a particular id, what method would provide the fastest way to increment the total_count in the shortest amount of time and minimize any locking?

Re: [GENERAL] Insert not finishing

2013-05-07 Thread Albe Laurenz
Johann Spies wrote: I am running python scripts to read tag-formated files and put the data into tables. Sometimes a script (I am running several of them in parallel on a server) just hangs. That happened now again and when I checked I saw this: SELECT

Re: [GENERAL] dataset lock

2013-04-19 Thread Albe Laurenz
Philipp Kraus wrote: Do you want to implement something like a queue? Yes You get a few rows by UPDATE table SET status = processing WHERE id IN (SELECT id FROM table WHERE status = waiting ORDER BY id LIMIT 5) RETURNING *; Then process and update the rows. This won't block

Re: [GENERAL] dataset lock

2013-04-17 Thread Albe Laurenz
Philipp Kraus wrote: My PG database is connected to differend cluster nodes (MPI). Each programm / process on each node are independed and run the SQL select * from table where status = waiting after that I update the row with the update statement (set status = working) so in this case one

Re: [GENERAL] How large can a PostgreSQL database get?

2013-04-17 Thread Albe Laurenz
Aleksey Tsalolikhin wrote: Hi. I was promoting PostgreSQL to an AIX/Oracle shop yesterday, they are looking to switch to open source to cut their licensing costs, and was asked how large a database does PostgreSQL support? Is there an upper bound on database size and if so, what it is?

Re: [GENERAL] GSL onto postgresql server 9.2

2013-04-15 Thread Albe Laurenz
Yuriy Rusinov wrote: I have to put some C-language functions onto postgresql server 9.2. These functions are used GSL software library http://www.gnu.org/software/gsl/. In Makefile for these functions I wrote LD_FLAGS = ... -lgsl, On some source-based Linux distributions such as gentoo

Re: [GENERAL] After dump/restoring from 32bit 8.4-windows to 64bit 9.2.4-linux experiencing 10x slowdown on queries

2013-04-10 Thread Albe Laurenz
Rob Sargent wrote: On 04/09/2013 02:29 PM, Giovanni Martina wrote: I'm trying to upgrade our database server from postgresql 32-bit 8.2.4 running on Windows Server 2008 to postgresql 64-bit 9.2.4 on ubuntu server 12.04.02 LTS. I have dumped one of our databases from our windows server and

Re: [GENERAL] What is pg backend using memory for?

2013-04-10 Thread Albe Laurenz
hubert depesz lubaczewski wrote: So, I checked a backend on Linux, and found such thing: 2ba63c797000-2ba63fa68000 rw-p 2ba63c797000 00:00 0 Size: 52036 kB Rss: 51336 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean:0 kB Private_Dirty:

Re: [GENERAL] Tablename.columnname%TYPE in Types On PostgreSQL 9.2

2013-04-09 Thread Albe Laurenz
Adrien Besson wrote: Trying to create a type using %Type seems not to work on PostgreSQL 9.2: CREATE TYPE type1 AS (tvar_1 TABLE1. COL1%TYPE , tvar_2 INTEGER); Returns XX ERROR: syntax error at or near % Where am I wrong ? Someone has an idea ? I think that the %TYPE syntax is

Re: [GENERAL] Acess Oracle with dbi-link (PostgreSQL) Error Compile

2013-03-26 Thread Albe Laurenz
Emanuel Araújo wrote: I'm having trouble making a base to access Oracle via dbi-link, because when installing DBD::Oracle version 1.58 the same mistakes some missing files. Ago as oci.h, it is being called within the oracle.h The purpose would be to sync data between two tools for

Re: [GENERAL] Alphanumeric natural order sorting : need generic solution

2013-03-22 Thread Albe Laurenz
Umashanker, Srividhya wrote: I am looking for a generic solution to get the Alphanumeric sorting. * The user can request for any field to be sorted. * There is no specific format the alphanumeric string can follow. So that we can split using regex and split and sorted. *

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Albe Laurenz
Adrian Klaver wrote: On 03/22/2013 05:32 AM, Bertrand Janin wrote: I noticed how rows were re-written to a different location (new ctid) even without changes to the values. This illustrate what I mean: -- ctid = (0,1) SELECT id, xmin, ctid, value FROM demo WHERE id = 1;

Re: [GENERAL] Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13

2013-03-20 Thread Albe Laurenz
Alexander Farber wrote: I have prepared an SQL fiddle for my question: http://sqlfiddle.com/#!11/8a494/4 And also described it in more detail at http://stackoverflow.com/questions/15500270/string-matching-in-insert-trigger-how-to-use-in- conditionals-to-return-null Does anybody please

Re: [GENERAL] Matching uppercased russian words (\x0410-\x042F) in UTF8 database 8.4.13

2013-03-20 Thread Albe Laurenz
Alexander Farber wrote: It seems to be better in 9.2.x? Yes, as Tom has pointed out. I didn't see that you were on 8.4 when I wrote my answer. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Concurrent updates

2013-03-19 Thread Albe Laurenz
Steve Erickson wrote: I have a table that I want to use as a queue with all functionality (Insert, update, delete) embodied in a stored procedure. Inserts and deletes are no problem. An external program would call the stored procedure to get one or more emails to work on, selecting on

Re: [GENERAL] C++Builder table exist

2013-03-18 Thread Albe Laurenz
Charl Roux wrote: Is there any way of getting PostgreSQL to work according to the SQL standard (The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case.), so there is no need for me to add

Re: [GENERAL] Avoiding a deadlock

2013-03-12 Thread Albe Laurenz
Paul Jungwirth wrote: Out of curiosity: any reason the ORDER BY should be in the subquery? It seems like it ought to be in the UPDATE (if that's allowed). Hmm, it's not allowed. :-) It's still surprising that you can guarantee the order of a multi-row UPDATE by ordering a subquery. To

Re: [GENERAL] PostgreSQL connect with Visual C++

2013-03-11 Thread Albe Laurenz
dhaval257 wrote: I worked upon this link you sent. It ends up giving error This applcation can not start because SSLEAY32.dll is missing. I want to connect in any form whether it is ODBC or direct. If you know then please help me. I am stuck here. Thank you So why don't you copy ssleay32.dll

Re: [GENERAL] restoring to different architecture with WAL

2013-03-11 Thread Albe Laurenz
Balázs Keresztury wrote: I have a postgres 8.4 on a Ubuntu box at my workplace [...] I already created the base backup with pg_start_backup and transferred to my computer, which is currently running Windows. The problem is that I can't even start up the base cluster, because postgres

Re: [GENERAL] Avoiding a deadlock

2013-03-11 Thread Albe Laurenz
Paul Jungwirth wrote: I have a long-running multi-row UPDATE that is deadlocking with a single-row UPDATE: 2013-03-09 11:07:51 CST ERROR: deadlock detected 2013-03-09 11:07:51 CST DETAIL: Process 18851 waits for ShareLock on transaction 10307138; blocked by process 24203.

Re: [GENERAL] Avoiding a deadlock

2013-03-11 Thread Albe Laurenz
Alban Hertroys wrote: All the suggestions thus far only reduce the window in which a dead lock can occur. Where do you see a window for deadlocks with my suggestions? Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Password Security Standarts on PostgreSQL

2013-03-08 Thread Albe Laurenz
MURAT KOÇ wrote: In Oracle, it could be created a user profile called PROFILE and this profile could have below specifications: PASSWORD_LIFE_TIME (that describes when password will expire) FAILED_LOGIN_ATTEMPTS (specifies number of failed login attempts before locking user account)

Re: [GENERAL] Password Security Standarts on PostgreSQL

2013-03-08 Thread Albe Laurenz
Victor Yegorov wrote: 2013/3/8 Albe Laurenz laurenz.a...@wien.gv.at This way you can also force a certain password expiry date (PostgreSQL does not have a password life time). What bout ALTER ROLE ... VALID UNTIL 'timestamp' ? That's the password expiry date. Oracle's concept is different

Re: [GENERAL] PostgreSQL connect with Visual C++

2013-03-06 Thread Albe Laurenz
dhaval257 wrote: I am new to postgres. I am doing Project on Image processing in OpenCV(IDE i am using is Visual C++ 2010). I have downloaded PostgreSQL 8.4 and installed it successfully. I want to know how to connect postgres with visual C++. Use something more recent than 8.4 if you can.

Re: [HACKERS] [GENERAL] Floating point error

2013-03-05 Thread Albe Laurenz
Daniel Farina wrote: On Mon, Mar 4, 2013 at 2:27 PM, Maciek Sakrejda m.sakre...@gmail.com wrote: On Sun, Mar 3, 2013 at 9:14 PM, Tom Lane t...@sss.pgh.pa.us wrote: The real difficulty is that there may be more than one storable value that corresponds to 1.23456 to six decimal digits. To be

Re: [GENERAL] 9.2 timestamp function syntax error

2013-03-05 Thread Albe Laurenz
Guy Rouillier wrote: I don't understand the error resulting from the following progression on 9.2 (specifically EnterpriseDB 9.2.1.3 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-52), 64-bit): select sysdate = timestamp without time zone select

Re: [GENERAL] broke postgres, how to fix??

2013-03-01 Thread Albe Laurenz
JD Wong wrote: Hi Adrian, yes I completely copied the config-file and data directories over. That's guaranteed to break everything badly. Even if I read only style copied the files? Do you mind elaborating on why this happens? ( or point me to relevant documentation ) The problem

Re: [GENERAL] warm standby question

2013-03-01 Thread Albe Laurenz
Sebastian Böhm wrote: I have a primary server (9.1), which does wal archiving like this: wal_level = hot_standby archive_mode = on archive_command = 'test ! -f /home/autobackup/wal/%f cp %p /home/autobackup/wal/%f' then I have a warm standby with this configuration in recovery.conf:

Re: [GENERAL] Floating point error

2013-03-01 Thread Albe Laurenz
Tom Duffey wrote (on -general): To bring closure to this thread, my whole problem was caused by not knowing about the extra_float_digits setting. We have a script that uses COPY to transfer a subset of rows from a very large production table to a test table. The script was not setting

Re: [GENERAL] Partitionning by trigger

2013-02-26 Thread Albe Laurenz
Ali Pouya wrote: I sent the following mail yesterday but I do not see it in the list. So I retry It is there all right: http://www.postgresql.org/message-id/CAEEEPmwq_3=hGEC69-2EkCWTiwq0dme==8sou29e9k2dccg...@mail.gmail.com I have created a partitionned table and a Pl/PgSQL trigger exactly as

Re: [GENERAL] Floating point error

2013-02-25 Thread Albe Laurenz
Tom Duffey wrote: Here is a smaller test case that does not involve Java. I guess this probably is just due to floating point error when the initial value is inserted that is too large for the field but it's still a surprise. Create a test table, insert a couple values and view the

Re: [GENERAL] Redefining a column within a view

2013-02-22 Thread Albe Laurenz
Jeffrey Schade wrote: We have a table which contains a 3 byte column with datatype CHAR(3) which we want to redefine within the view as a CHAR(1) column and a CHAR(2) column. When I code the SUBSTR function the resulting column datatype is TEXT. I would like to see the CHAR datatype, is

Re: [GENERAL] subselects vs WITH in views

2013-02-19 Thread Albe Laurenz
Joe Van Dyk wrote: My assumption was that WITH acted just like subselects, but apparently they don't? Using WITH doesn't use the expected index. Currently WITH acts as an optimization fence, that means that means that the planner won't move conditions into or out of the WITH query. Yours,

Re: [GENERAL] Terminate query on page exit

2013-02-19 Thread Albe Laurenz
david harel wrote: I use postgresql on a Linux server on a virtual machine (despite my protest to IT personal). The client is typically a web server implementing PHP sites. Customers many times close a page typically when a heavy report runs for too long. Using the command top, I got the

Re: [GENERAL] Terminate query on page exit

2013-02-19 Thread Albe Laurenz
patrick keshishian wrote: Any method to kill such query would it still hang out there? One crude method would be to set statement_timeout to a nonzero value - then queries that take longer than that many seconds will be canceled. you don't truly mean to advise that, do you? :) Well, it

Re: [GENERAL] Streaming replication and sharding

2013-02-18 Thread Albe Laurenz
Tiemo Kieft wrote: We are developing an application that uses various web analytics packages (like Google Analytics) to run analyses on. We are currently in closed beta stadium where we don't have a lot of data in the database, but at some point it will grow considerably. We basically

Re: [GENERAL] Immutable functions, Exceptions and the Query Optimizer

2013-02-18 Thread Albe Laurenz
Cochise Ruhulessin wrote: Regarding your question about what the CHECK constraint should achieve, I had abstracted by use case into Books/Book Types, which may have caused some vagueness. The actual use case are the following tables. [...] CREATE TABLE persons( person_id int8 NOT

Re: [GENERAL] Immutable functions, Exceptions and the Query Optimizer

2013-02-15 Thread Albe Laurenz
Cochise Ruhulessin wrote: If an immutable function raises an exception, is that exception cached by the query optimizer? Or does it only cache in the case that a function actually returns a value? If an error occurs, query processing is terminated, so nothing needs to be cached. PostgreSQL

Re: [GENERAL] Reset permissions on table

2013-02-15 Thread Albe Laurenz
etienne champetier wrote: By default there is no permissions on table (\dp return 0 row) If I make a GRANT, doing a REVOKE will not get me in the 'default' state How to return in the default state, where permission are 'inherited' from owner. \dp should return a row for each table in your

Re: [GENERAL] Reset permissions on table

2013-02-15 Thread Albe Laurenz
etienne champetier wrote: By default there is no permissions on table (\dp return 0 row) If I make a GRANT, doing a REVOKE will not get me in the 'default' state How to return in the default state, where permission are 'inherited' from owner. \dp should return a row for each table in your

Re: [GENERAL] Installing Postgress 8.0.5 in Ubuntu 10.12

2013-02-14 Thread Albe Laurenz
Vick Khera wrote: There are some implicit casting changes that broke some of my code when 8.2 came out. You mean 8.3, right? Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] PG V9 on NFS

2013-02-13 Thread Albe Laurenz
John R Pierce wrote: Oracle supports a Netapp Filer with NFSv4, and a specific set of configurations.they don't support anything else NFS last I heard. whats good for Oracle is generally good for Postgres. Oracle supports NFS everywhere except on Windows. The new direct NFS feature (where

Re: [GENERAL] trying to use CLUSTER

2013-02-13 Thread Albe Laurenz
David Sahagian wrote: Version=9.1.7 INFO: clustering my_cool_table using sequential scan and sort INFO: my_cool_table: found 1 removable, 1699139 nonremovable row versions in 49762 pages Detail: 1689396 dead row versions cannot be removed yet. CPU 9.80s/4.98u sec elapsed 175.92 sec. My

Re: [GENERAL] Differences when calling query inside and outside cursor

2013-02-13 Thread Albe Laurenz
Carlos Henrique Reimer wrote: We're facing a weird performance problem in one of our PostgreSQL servers running 8.0.26. Ouch. 8.0 has been out of support since October 2010, and I am afraid that might be a problem for you. What can explain the difference between calling same query inside and

Re: [GENERAL] How to get stored procedure args list from metadata tables ?

2013-02-13 Thread Albe Laurenz
Dave Gauthier wrote: Looking for a table or view which contains the list of arguments that are passed to a stored procedure. Doesn't seem to be in pg_proc.prosrc or other pg_proc columns. This information is in the following columns of pg_proc: proargtypes, proallargtypes, proargmodes,

Re: [GENERAL] archive_mode=on on a Slave in streaming replication mode

2013-02-13 Thread Albe Laurenz
james.sewell wrote: As per the topic is it possible to set archive_mode and archive_command on a server which is configured as a streaming replication hot standby? I've tried and it doesn't seem to work, so I'm guessing maybe it's disabled. It works fine, only the server will not generate

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-08 Thread Albe Laurenz
Gavan Schneider wrote: But I feel I have missed something here. Referring to: http://www.postgresql.org/docs/current/static/sql-createtable.html CHECK constraints, NOT NULL constraints and FOREIGN KEY constraints all look very deferrable in this definition. If that's the case, why are we

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-08 Thread Albe Laurenz
Gavan Schneider wrote: And this leads to a thought. Why is it that in this chapter the documentation gives a synopsis which is not correct for the current implementation but relies on a negation much further down the page to properly describe the actual behaviour? The synopsis gives the

Re: [GENERAL] Decrease the time required function

2013-02-08 Thread Albe Laurenz
Karel Riverón wrote: I have a PL/pgSQL function that it takes 4 seconds to execute. This is my function: CREATE OR REPLACE FUNCTION listarcasosrecuperados(escenario_id integer) RETURNS SETOF caso_real AS [...] OPEN criterios; LOOP FETCH criterios into c; IF NOT FOUND THEN EXIT;

Re: [GENERAL] Bug, Feature, or what else?

2013-02-08 Thread Albe Laurenz
Andreas Kretschmer wrote: i have created a normal user (no superuser) akretschmer01 and another normal user ak02. All fine. The first user is the owner of the db. As user akretschmer01 i granted: db115150= grant all on schema public to ak02; There are no tables or other objects createt

Re: [GENERAL] Bug, Feature, or what else?

2013-02-08 Thread Albe Laurenz
Andreas Kretschmer wrote: db115150=# revoke all on schema public from ak02; REVOKE db115150=# drop user ak02; FEHLER: kann Rolle »ak02« nicht löschen, weil andere Objekte davon abhängen DETAIL: Privilegien für Schema public So what does \dn+ public show? db115150=# \dn+ public

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-07 Thread Albe Laurenz
Dean Rasheed wrote: ISO/IEC 9075-2:2003 says: Chapter 10.8 (constraint name definition and constraint characteristics): constraint characteristics ::= constraint check time [ [ NOT ] DEFERRABLE ] | [ NOT ] DEFERRABLE [ constraint check time ] constraint check time ::= INITIALLY

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-07 Thread Albe Laurenz
Jasen Betts wrote: Well, the standard syntax allows them to be requested, check constraints too. what does the standard say about it behaviourally? What you'd expect: The checking of a constraint depends on its constraint mode within the current SQL-transaction. If the constraint mode is

Re: [GENERAL] Need help understanding WAL and checkpoints

2013-02-06 Thread Albe Laurenz
drew_hunt wrote: I'm trying to get my head around WAL and checkpoints and need to ask a couple of questions before I get a headache. Firstly, I see the terms WAL log, WAL file and transaction log all over the place - are these the same thing (i.e. files in the pg_xlog directory)?

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-06 Thread Albe Laurenz
Gavan Schneider wrote: Taking a different tangent ... Good idea. Is there anything in the SQL standards about NOT NULL constraints being deferrable? To my mind we should not consider implementing non-standard behaviour, but if something is in the standard I can't see why it shouldn't be

Re: [GENERAL] REINDEX deadlock - Postgresql -9.1

2013-02-06 Thread Albe Laurenz
Anoop K wrote: We are hitting a situation where REINDEX is resulting in postgresql to go to dead lock state for ever. On debugging the issue we found that 3 connections are going in to some dead lock state. 1.idle in transaction 2.REINDEX waiting 3.SELECT waiting All these

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Albe Laurenz
Andreas Joseph Krogh wrote: It's currently (9.2) not possible to define DEFERRABLE NOT NULL constraints. Meaning the following is not valid: CREATE TABLE my_table( id varchar PRIMARY KEY, stuff_id BIGINT NOT NULL DEFERRABLE INITIALLY DEFERRED ); While it's possible to define a trigger

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Albe Laurenz
Bèrto ëd Sèra wrote: Why do that as a trigger, then? Why not simply call a procedure that generates the value and inserts it? Because this must be unknown to whoever makes the call and I'm not supposed to expose any detail of what's going on behind the scenes. Outsourcing part of

Re: [GENERAL] tablespace directories

2013-02-05 Thread Albe Laurenz
Bèrto ëd Sèra wrote: creation path/PG_9.2_201204301/dboid the mystery is around the version_date (or so it would seem to be) part. That's the catalog version. You can't get it from the catalogs AFAIK, but the pg_controldata server utility will show the information. If you really need, you

Re: [GENERAL] Deleting 173000 records takes forever, blocks async queries for unrelated records

2013-02-01 Thread Albe Laurenz
Alexander Farber wrote: in a Facebook game running on PostgreSQL 8.4.13 and having so many players: # select count(*) from pref_users; count 223964 I am trying to get rid of inactive users, who just visited the canvas page, but never played (I'm sure, Facebook has a

Re: [GENERAL] AT TIME ZONE and interval arguments

2013-01-31 Thread Albe Laurenz
Craig Ringer wrote: I'm mildly thrown by this: regress= SELECT TIME '04:00' AT TIME ZONE '01:00'; timezone - 19:00:00-01 (1 row) regress= SELECT TIME '04:00' AT TIME ZONE (INTERVAL '01:00'); timezone - 21:00:00+01 (1 row) regress= SELECT TIME '04:00'

Re: [GENERAL] Dropping default privileges.

2013-01-30 Thread Albe Laurenz
Tim Uckun wrote: drop role tim; ERROR: role tim cannot be dropped because some objects depend on it DETAIL: owner of default privileges on new relations belonging to role tim in schema strongmail DROP OWNED BY ought to get rid of that. Just to be clear. I don't want to drop the

Re: [GENERAL] Fwd: Functions not visible in pg_stat_user_functions view

2013-01-30 Thread Albe Laurenz
Bartosz Dmytrak wrote: and this is strange for me. I have few DBs with the same function (copy - paste), in one DB they are tracked (visible in pg_stat_user_functions) in other not. In DB where some functions are not tracked, others are visible - no issue. I cannot find any logical

Re: [GENERAL] database design best pratice help

2013-01-28 Thread Albe Laurenz
Jose Soares wrote: I have a question about database design best pratice. In my db I have about one hundred tables like this: code description To avoid to have a so great number of similar tables in the db I wonder if it is a good idea to unify all these tables in one big table like

Re: [GENERAL] Running update in chunks?

2013-01-25 Thread Albe Laurenz
Tim Uckun wrote: I dropped the index and the numbers shot up tenfold or more. I don't know why postgres feels the need to update the GIN index on the hstore field when I am only updating an integer field but it looks like I need to split the hstore into a different table. Every UPDATE that

Re: [GENERAL] DB alias ?

2013-01-24 Thread Albe Laurenz
Guillaume Lelarge wrote: On Thu, 2013-01-24 at 09:01 +0530, Shridhar Daithankar wrote: On Wednesday, January 23, 2013 09:39:43 PM Gauthier, Dave wrote: Then someone who wants to look at old JAN data will have the same problem :-( If I recall, Oracle enables something like this.

Re: [GENERAL] pg_Restore

2013-01-21 Thread Albe Laurenz
bhanu udaya wrote: I tried with all the below options. It approximatly takes 1 hour 30 minutes for restoring a 9GB database. This much time can not be affordable as the execution of test cases take only 10% of this whole time and waiting 1 hour 30 minutes after every test case execution is

Re: [GENERAL] pg_Restore

2013-01-21 Thread Albe Laurenz
bhanu udaya wrote: Can you please let me know the procedure for Template. Will it restore the data also . It will create a complete copy of an existing database The procedure is CREATE DATABASE newdb TEMPLATE olddb; Nobody may be connected to olddb for this to work. Yours, Laurenz Albe

Re: [GENERAL] String comparison and the SQL standard

2013-01-21 Thread Albe Laurenz
Tom Lane wrote: I tested not only with string literals, but also comparing table columns of the respective types. I came up with the following table of semantics used for comparisons: | CHAR(n)=CHAR(n) | VARCHAR(n)=VARCHAR(n) | CHAR(n)=VARCHAR(n) |

Re: [GENERAL] String comparison and the SQL standard

2013-01-18 Thread Albe Laurenz
Tom Lane wrote: b) If the length in characters of X is not equal to the length in characters of Y, then the shorter string is effectively replaced, for the purposes of comparison, with a copy of itself that has been extended to the length of the longer string by

[GENERAL] String comparison and the SQL standard

2013-01-17 Thread Albe Laurenz
While researching a problem with a different database system, I came across the following in the SQL standard ISO/IEC 9075-2:2003, Section 8.2 (comparison predicate), General Rules: 3) The comparison of two character strings is determined as follows: a) Let CS be the collation as determined by

Re: [GENERAL] String comparison and the SQL standard

2013-01-17 Thread Albe Laurenz
I wrote: While researching a problem with a different database system, I came across the following in the SQL standard ISO/IEC 9075-2:2003, Section 8.2 (comparison predicate), General Rules: 3) [...] That would effectively mean that 'a'='a ' is TRUE for all character string types.

Re: [GENERAL] Streaming Replication

2013-01-15 Thread Albe Laurenz
ning chan wrote: I am new to PG Streaming Replication and I have a simple question hopefully someone can answer this easily. I setup a Primary Hot Standby and they are connecting each other without problem. Looking at the wal sender process, both servers pointing to the same location

Re: [GENERAL] Recommendations on plpgsql debugger?

2013-01-15 Thread Albe Laurenz
Chris Travers wrote: I have a client who needs a way to step through a PL/PGSQL function and ideally see what one is doing at present. I noticed that there used to be an EDB Debugger module for this purpose but I can't seem to find one for 9.1 and I can't seem to pull from csv to try.

Re: [GENERAL] evaluating expressions stored in table

2012-12-19 Thread Albe Laurenz
Douglas Little wrote: I need to evaluate an expression that I have stored in a table, and not sure how to force evaluation of a column value. [...] The pass/fail query looks something like this Update testscore Set metricstatus = case when table_a.col_a = table_b.col_bthen 'PASS'

Re: [GENERAL] Vacuum analyze verbose output

2012-12-19 Thread Albe Laurenz
Anjali Arora wrote: I ran following command on 8.2.2 postgresql: psql -p port dbname -c vacuum analyze verbose last few lines from vacuum analyze verbose output: DETAIL: A total of 2336 page slots are in use (including overhead). 2336 page slots are required to track all free space.

Re: [GENERAL] Join several tables (to fetch user info), but one of them is optional (user avatar)

2012-12-19 Thread Albe Laurenz
Alexander Farber wrote: given a user name in a Drupal 7.17 database using PostgreSQL 8.4.13 I am trying to fetch user info (uid, city, gender, avatar) distributed over several tables. The avatar is however optional - some users don't have it. For users, that do have avatars my query works

Re: [GENERAL] problem with large inserts

2012-12-17 Thread Albe Laurenz
Lutz Fischer wrote: I have currently some trouble with inserts into a table INSERT INTO LPP (PPID, LID) SELECT DISTINCT PPid, LID FROM (SELECT * FROM PP WHERE s_id = sid) pp INNER JOIN has_protein hp1 ON pp.p1id = hp1.pid INNER JOIN

Re: [GENERAL] Setting default privs for a user doesn't seem to work.

2012-12-07 Thread Albe Laurenz
Dave Gauthier wrote: What's wrong with this picture. Trying (failing) to create a user called select with default select privs and nothing else. Demo below. Comments in red... sde=# alter default privileges for user select grant select on tables to select; ALTER DEFAULT PRIVILEGES

Re: [GENERAL] ALTER EXTENSION UPDATE: How to update the 'module_pathname'?

2012-12-06 Thread Albe Laurenz
Henrik Kuhn wrote: after installing an extension with functions with C bindings - CREATE OR REPLACE FUNCTION ... AS 'MODULE_PATHNAME' LANGUAGE C ... - I like to change the 'module_pathname' upon its update. After reading the docs and especially the section of 'ALTER EXTENSION' I have the

Re: [GENERAL] Installing minimal client libraries on Windows

2012-12-06 Thread Albe Laurenz
Mark Morgan Lloyd wrote: Apologies for this old chestnut, but I think it's a question more often asked than answered. If I want to install a minimal binary libpq.dll on a non-developer machine to support Lazarus/FPC programs, where do I get it? I definitely don't want to tell the users to

Re: [GENERAL] wal archiving question

2012-12-06 Thread Albe Laurenz
akp geek wrote: thank you so much for all the inputs.. One final question is , Do we have to stop the database when we create the base backup? No, see http://www.postgresql.org/docs/9.0/static/continuous-archiving.html#BACKUP-BASE-BACKUP Yours, Laurenz Albe -- Sent via pgsql-general

Re: [GENERAL] how do I grant select to one user for all tables in a DB?

2012-12-05 Thread Albe Laurenz
Dave Gauthier wrote: V9.1.5 on linux User select created (yup, that's right, they want the user name to be select. Guess what ptivs it is to have! Don't kill the messanger :-) ) postgres=# grant select on all tables in schema sde to select; ERROR: schema sde does not exist postgres=#

Re: [GENERAL] Database schema

2012-12-05 Thread Albe Laurenz
Andreas Kretschmer wrote: Albe Laurenz laurenz.a...@wien.gv.at wrote: Dhiraj Gupta wrote: I have  created a database name 'ofbiz. then the default  schema name public created automatically. I want to create schema name ofbiz in the database ofbiz  when I create database name ofbiz

<    1   2   3   4   5   6   7   8   9   10   >