Re: [GENERAL] How to prevent clear screen when query finish ?

2013-08-08 Thread Alban Hertroys
On 7 August 2013 18:01, Adrian Klaver wrote: > On 08/07/2013 08:53 AM, Condor wrote: > http://www.postgresql.org/docs/9.2/interactive/app-psql.html > > pager > Controls use of a pager program for query and psql help output. If the > environment variable PAGER is set, the output is piped to the sp

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Alban Hertroys
each child node. That's been supported in PG versions like forever and can be queried fairly efficiently using recursive CTE's since PG 9. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-g

Re: [GENERAL] Re: Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure PLEASE CAN SOMEONE HELP!! (nearly fixed)

2013-08-03 Thread Alban Hertroys
base login role, making it look like there's a relation between OS users and database users, but that's not actually the case (although there's an authentication option in pg_hba.conf to require such a relation). At least, this is how I think it works. If I'm wrong someone w

Re: [GENERAL] Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure PLEASE CAN SOMEONE HELP!!

2013-08-02 Thread Alban Hertroys
g the postgres user, you can then also create a database account for your SDB user. P.S. In this mailing list it is not customary to top-post. You're on a Micrososft OS, possibly using the abomination of a mail client called Outlook, so you can possibly not help it, but if you can, pl

Re: [GENERAL] Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure PLEASE CAN SOMEONE HELP!!

2013-07-31 Thread Alban Hertroys
could elaborate on what you're doing to connect and what error you receive? It's possible that you locked yourself out through the pg_hba.conf file or that you need to reset the password for the postgres user. But we don't know that yet... > -Original Message- > From: Alba

Re: [GENERAL] Postgres 9.2.4 for Windows (Vista) Dell Vostro 400, re-installation failure PLEASE CAN SOMEONE HELP!!

2013-07-31 Thread Alban Hertroys
ou follow to move your data to the D-drive? That seems a likely cause of trouble, especially if the database was running while you did that - you may be looking at an unrecoverable database snapshot if you didn't take precautions, in which case the database would refuse to start up. Alban

Re: [GENERAL] Snapshot backups

2013-07-31 Thread Alban Hertroys
ealise these are typical "what if" scenario's, so I suppose answering these doesn't have a high priority. It's just that I've been wondering/worrying about the seeming increase of people reporting database corruption - I was just wondering whether issues like these might

Re: [GENERAL] [BUGS] Incorrect response code after XA recovery

2013-07-29 Thread Alban Hertroys
all we know at this point, the error is with your XA manager, not with Postgres. If you want to be sure, grep the source of the JDBC driver for those error codes; I doubt you'll find them in there. Google was kind enough to point me here: http://jdbc.postgresql.org/development/git.html Alban

Re: [GENERAL] how to get UPDATEXML function in postgresql as it works in oracle

2013-07-29 Thread Alban Hertroys
Perhaps you would care to explain? I think that increases your chances of getting an answer ;) Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.o

Re: [GENERAL] dynamic table names

2013-07-17 Thread Alban Hertroys
me::regclass || ' where firstname = ''john''' into e; > but i am getting an error: > > > ERROR: syntax error at or near "'select * from '" at character 9 Do you always get that error or do you only get it with certain table names? If so,

Re: [GENERAL] passing text value with single quote to stored procedure

2013-07-13 Thread Alban Hertroys
edures. You need to escape the string properly for SQL. select load_stage_start_v1('QA_SUMMER''2013_(EU/US)'); Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing

Re: [GENERAL] function query error: column does not exist

2013-07-11 Thread Alban Hertroys
On 11 July 2013 11:01, giozh wrote: > this is the insert code: > > >EXECUTE 'INSERT INTO table VALUES('||value1||','[...]','||value_char||')'; > > and the error is on value_char. pg told me that "column does not exist". > A few suggestions: 1. Post a statement that actually matches your problem

Re: [pgadmin-support] [GENERAL] Postgres case insensitive searches

2013-06-29 Thread Alban Hertroys
On Jun 29, 2013, at 15:02, bhanu udaya wrote: > I agree that it is just search condition. But, in a 2.5 million record table > search, upper function is not that fast. Suit yourself, the solution is there. Alban Hertroys -- If you can't see the forest for the trees, cut the trees

Re: [GENERAL] Postgres case insensitive searches

2013-06-29 Thread Alban Hertroys
this capability (Postgres makes use of the OS collation mechanics). So, what OS are you running the server on? > > From: laurenz.a...@wien.gv.at > > To: udayabhanu1...@hotmail.com; pgsql-general@postgresql.org > > Subject: RE: Postgres case insensitive searches > > Date:

Re: [GENERAL] utf8 errors

2013-06-28 Thread Alban Hertroys
On Jun 26, 2013, at 16:58, Alban Hertroys wrote: > On 26 June 2013 11:03, Jiří Pavlovský wrote: > On 26.6.2013 10:58, Albe Laurenz wrote: > > Jirí Pavlovský wrote: > >> I have a win32 application. > >> LOG: statement: INSERT INTO reci

Re: [GENERAL] utf8 errors

2013-06-27 Thread Alban Hertroys
fferent problem, as you are actually dealing with accented characters in your data. The OP was dealing with integers, which tend to not have accented characters in them. I suggest that you create a separate thread for your issue, as they're probably not related. Alban Hertroys -- If you

Re: [GENERAL] utf8 errors

2013-06-26 Thread Alban Hertroys
On 26 June 2013 11:03, Jiří Pavlovský 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 se

Re: [GENERAL] utf8 errors

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

Re: [GENERAL] utf8 errors

2013-06-26 Thread Alban Hertroys
On 26 June 2013 11:17, Jiří Pavlovský 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 se

Re: [GENERAL] pg_restore order and check constraints

2013-06-23 Thread Alban Hertroys
7;t fire too early. It's a choice between abusing a check constraint for something it wasn't entirely meant for or using a trigger. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] File System backup

2013-06-21 Thread Alban Hertroys
abase files. What file-system is the database on? Is it possible a journal rollback caused inconsistency in the database? Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-g

Re: [GENERAL] type-casting failures

2013-06-21 Thread Alban Hertroys
o you can look up the trouble-makers easily. Another option is using an ETL tool to extract the data from your database and load it back in into the appropriate tables. That would work quite similar as the stored procedure approach, but you get more bells and whistles as an advantage. Alban Hertroys --

Re: [GENERAL] Circular references

2013-06-21 Thread Alban Hertroys
On 21 June 2013 05:08, Tom Lane wrote: > Melvin Call writes: > > I was given a dump of an existing remote schema and database, and the > > restore on my local system failed. Looking into it, I found a circular > > parent-child/child-parent relationship, and I don't believe this existing > > stru

Re: [GENERAL] Exporting Data

2013-06-20 Thread Alban Hertroys
a sufficiently unique requirement that there probably is no way to do that natively. Using a scripting language is probably your best bet. If you're already familiar with some, pick one of those. If not, I suggest Python (with the psycopg2 postgresql driver). There's even a version fo

Re: [GENERAL] Type cast errors in version 9.2 while upgrade

2013-06-18 Thread Alban Hertroys
On 18 June 2013 14:38, Arun P.L wrote: > > Hi All, > > We are doing a postgresql upgrade from version 7.4.30 to 9.2. While > testing the queries in newer version, the following error is obtained for > some of the queries which were working fine in older version. > > * > > "ERROR: operator does n

Re: [GENERAL] Get multiple columns with counts from one table.

2013-06-12 Thread Alban Hertroys
' > group by type > > Is this possible with postgresql??? You can do that like this: SELECT type, SUM(CASE place WHEN 'home' THEN 1 ELSE 0 END), SUM(CASE place WHEN 'school' THEN 1 ELSE 0 END), etc. FROM reports WHERE place IN ('home'

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

2013-06-11 Thread Alban Hertroys
Because you're calculating a - (b/c) instead of (a-b)/c On 11 June 2013 11:51, Alexander Farber wrote: > Hello! > > 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(null

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

2013-05-08 Thread Alban Hertroys
ner would be able to do based on the statistics for the values being updated. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.

Re: [GENERAL] Insert not finishing

2013-05-07 Thread Alban Hertroys
You're probably waiting on a lock from another process. Check pg_locks. On 7 May 2013 11:38, 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.

Re: [GENERAL] UPDATE with subquery; possible bug in query parser?

2013-04-20 Thread Alban Hertroys
re clause? > UPDATE foo > SET kind = 'LLC' > WHERE otherid IN > (SELECT otherid > FROM other > WHERE name != 'Nothing'); > > -- Check results > SELECT COUNT(*) FROM foo WHERE kind = 'LLC'; -- expect 4, but returns 5 Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.

Re: [GENERAL] Why is PostgreSQL 9.1 not using index for simple equality select

2013-04-12 Thread Alban Hertroys
On 12 April 2013 10:45, Yang Zhang wrote: > explain select * from lead where email = 'f...@blah.com'; > What about: explain analyze select * from lead where email = 'f...@blah.com'; -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest.

Re: [GENERAL] data modeling genes and alleles... help!

2013-03-30 Thread Alban Hertroys
alleles related to genes? (Hence my previous remark) If that's the case, you'd add a gene foreign key to each allele table and then store which alleles are related to a person instead of which genes are related to a person. The genes then follow from the alleles. Is that closer to what you're after? Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.

Re: [GENERAL] Why does Postgres allow duplicate (FK) constraints

2013-03-26 Thread Alban Hertroys
On 26 March 2013 17:07, Thomas Kellerer wrote: > Is there anything in the standard that actively requires that you can >>> create two "identical" constraints? >> >> > Because technically it simply doesn't make sense, does it? > It can make sense during a maintenance window, if you create a new (

Re: [GENERAL] Referencing parts captured by round brackets in a regex in 8.4.13

2013-03-22 Thread Alban Hertroys
On 22 March 2013 16:08, Alexander Farber wrote: > Thank you, this works better, but - > the result is correctly "true" now, > but the warning is still there, why? > > # select 'axyz' ~ '(.)\\1\\1'; > WARNING: nonstandard use of \\ in a string literal > LINE 1: select 'axyz' ~ '(.)\\1\

Re: [GENERAL] Bad plan on a huge table query

2013-03-21 Thread Alban Hertroys
z colours them red). Are you using autovacuum? If so, you probably need to tune it more aggressively. For the short term, running an ANALYSE on those tables should at least get you more accurate query plans. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.

Re: [GENERAL] Problem in "Set search path"

2013-03-21 Thread Alban Hertroys
On 21 March 2013 16:59, Kalai R wrote: > Hi, > Thanks for ur suggestions. I create connection from my .net application > and set search path by single query. After set search path I call psql > function from my .net application using the same connection. In this case > some time search path set

Re: [GENERAL] Addled index

2013-03-16 Thread Alban Hertroys
w, which normally wouldn't be possible. I'm mostly guessing, but perhaps one of the below has something to do with it: Maybe you turned fsync off? What type of index is that? A standard btree or one of the newer types? Are those tables and indexes perhaps on some kind of virtual storage or

Re: [GENERAL] table spaces

2013-03-13 Thread Alban Hertroys
On 12 March 2013 22:31, Gregg Jaskiewicz wrote: > Ok, > > So by that token (more drives the better), I should have raid 5 (or > whichever will work) with all 6 drives in it ? > Raid 5 is usually advised against, as in many scenarios it won't perform very well. For example, see: http://www.revsys

Re: [GENERAL] Avoiding a deadlock

2013-03-11 Thread Alban Hertroys
On 11 March 2013 13:01, Chris Curvey wrote: > On Sat, Mar 9, 2013 at 4:20 PM, Paul Jungwirth < > p...@illuminatedcomputing.com> 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

Re: [GENERAL] ERROR: relation "employees" does not exist

2013-03-11 Thread Alban Hertroys
On 11 March 2013 07:39, Csanyi Pal wrote: > but when I run the command: > CREATE TABLE employee_schedule ( > id serial, > employee_id integer REFERENCES employees(id), > start_time timestamptz, > end_time timestamptz > ); > > I get an error message: > > NOTICE: CREATE TABLE will create i

Re: [GENERAL] GetHierarchy

2013-03-01 Thread Alban Hertroys
> 3 5 > 5 6 > 6 7 > > Any reply on this is great help. You're probably looking for recursive common table expressions: http://www.postgresql.org/docs/9.2/static/queries-with.html Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you&#x

Re: [GENERAL] autoanalyze criteria

2013-02-25 Thread Alban Hertroys
On Feb 25, 2013, at 7:23, Stefan Andreatta wrote: > On 02/24/2013 12:52 PM, Alban Hertroys wrote: >> On Feb 23, 2013, at 14:11, Stefan Andreatta wrote: >> >>> And we are still missing a number for rows updated since the last analyse. >> >> In MVCC an

Re: [GENERAL] autoanalyze criteria

2013-02-24 Thread Alban Hertroys
On Feb 23, 2013, at 14:11, Stefan Andreatta wrote: > And we are still missing a number for rows updated since the last analyse. In MVCC an update is an insert + delete, so you already got those numbers. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you

Re: [GENERAL] limit based on count(*)

2013-02-22 Thread Alban Hertroys
On 22 February 2013 17:01, Steve Clark wrote: > select serial_no, count(*) as "restarts" from event_log where event_mesg > ilike 'system sta%' and event_date > current_date - 7 > group by serial_no order by restarts > select serial_no, count(*) as "restarts" from event_log where event_mesg ilik

Re: [GENERAL] How to remove an item from integer array type

2013-02-20 Thread Alban Hertroys
liar. What would probably work is to split the array around the value to remove, and merge those arrays again. Something like this: => select (ARRAY[100, 101, 102, 103, 104])[1:2] || (ARRAY[100, 101, 102, 103, 104])[4:5]; ?column? --- {100,101,103,104} (1 row)

Re: [GENERAL] Why is this a cross join?

2013-02-17 Thread Alban Hertroys
nation of the same 6-character value. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.

Re: [GENERAL] Upsert Functionality using CTEs

2013-02-10 Thread Alban Hertroys
ique keys for people. For this particular case I'd suggest adding a surrogate key. Alternatively, you might try using (first_name, email) as your key. You'll probably still get some duplicates, but they should be less and perhaps few enough for your case. Alban Hertroys -- If you can

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-06 Thread Alban Hertroys
On 6 February 2013 12:56, Chris Angelico wrote: > If you get into a taxi and ask > to be driven to New Zealand within the hour, no amount of begging will > get you what you want. > ...Unless you get into a taxi in New Zealand. -- If you can't see the forest for the trees, Cut the trees and you

Re: [GENERAL] "explain analyze" a procedure verbosely - to find which statement in it takes longer

2013-02-06 Thread Alban Hertroys
On 6 February 2013 11:03, Alexander Farber wrote: > begin > > insert into pref_ban2 select > id, > first_name, > last_name, > city, > last_ip >

Re: [GENERAL] [BUGS] BUG #7850: left outer join is not working or I didn't contruct the query properly

2013-02-05 Thread Alban Hertroys
On 5 February 2013 17:06, Amit Kapila wrote: > Tuesday, February 05, 2013 12:40 PM nvardar wrote: > > throws; > > > > >[Error] Script lines: 1-20 - > > ERROR: Node 2 has aborted execution, cause is: > > com.edb.gridsql.exception.XDBServerException : > > java.lang.NullPoin

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Alban Hertroys
On 5 February 2013 14:20, Bèrto ëd Sèra wrote: > Hi Chris, > > > I don't see > > any reason to create a record with a NULL and then replace that NULL > > before committing. Sort out program logic first; then look to the > > database. > > I beg to differ here. Say you have a set of business rules

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Alban Hertroys
On 5 February 2013 12:41, Andreas Joseph Krogh wrote: > There are lots of things you can do, but when it's the ORM which does it > you have limited control, and that's the way it should to be (me as > application-developer having to worry less about such details). > In that case it's your ORM th

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Alban Hertroys
On 5 February 2013 11:15, Andreas Joseph Krogh wrote: > På tirsdag 05. februar 2013 kl. 11:04:27, skrev Thomas Kellerer < > spam_ea...@gmx.net>: > > Andreas Joseph Krogh, 05.02.2013 10:57: > > The value of having NOT NULL deferrable is, well, to not check for > > NULL until the tx commits. When w

Re: [GENERAL] self join for history analyzis

2013-01-26 Thread Alban Hertroys
On Jan 26, 2013, at 13:32, Rafał Pietrak wrote: > I have a usage recording table: CREATE TABLE readings(tm timestamp, bytesin > int, bytesout int); > > The readouts are made "occasionally" - the timespan between the readouts are > not very precise, but there is a lot of those readouts. > > wh

Re: [GENERAL] Optimizing select count query which often takes over 10 seconds

2013-01-24 Thread Alban Hertroys
> > It's sorting on disk. That's not going to be fast. Indeed, it's taking > > nearly all the time the query takes (4.4s for this step out of 4.5s for > the > > query). > > I've noticed that too, but what > does "sorting on disk" mean? > > I have a lot of RAM (32 GB) , > should I increase work_mem

Re: [GENERAL] Optimizing select count query which often takes over 10 seconds

2013-01-24 Thread Alban Hertroys
On 24 January 2013 10:57, Alexander Farber wrote: > # explain analyze select count(id) from ( > select id, >row_number() over(partition by yw order by money > desc) as ranking > from pref_money > ) x > where x.ranking = 1 and id='OK452217

Re: [GENERAL] Case insensitive collation

2013-01-21 Thread Alban Hertroys
On 21 January 2013 17:25, Marcel van Pinxteren < marcel.van.pinxte...@gmail.com> wrote: > The other reason, is that I assume that "lower()" adds overhead, so makes > things slower than they need to be. > Whether that is true, and if that is a compelling reason, I don't know. > Case insensitive co

Re: [GENERAL] pg_Restore

2013-01-21 Thread Alban Hertroys
On 21 January 2013 16:10, bhanu udaya wrote: > Can you please let me know the procedure for Template. > As they say, Google is your friend. The basic principle is this: You create a read-only (template) version of your sample database and use that as a template for the creation of new ones. Of

Re: [GENERAL] Case insensitive collation

2013-01-18 Thread Alban Hertroys
You could look into running the DB on an OS that does support case insensitive collation. It'll likely perform better too. On 16 January 2013 20:40, Marcel van Pinxteren < marcel.van.pinxte...@gmail.com> wrote: > From the Microsoft site I learned > http://msdn.microsoft.com/en-us/library/ms18804

Re: [GENERAL] plpython intermittent ImportErrors

2013-01-17 Thread Alban Hertroys
On 17 January 2013 12:30, Brian Sutherland wrote: > > (we use buildout for our Python code, but our plpythonu stored > > procedures use the stock standard Python environment, as provided by > > the Ubuntu packages). > > Sadly, I need to get this running on OSX as that's what our developers > use.

Re: [GENERAL] Libpq and multithreading

2013-01-14 Thread Alban Hertroys
An access violation means that you're trying to access memory that doesn't belong to your process. I'm not sure where it's originating, that could be the server but I suspect the issue is at the client-side. You're probably just forgetting to free memory somewhere. On 14 January 2013 13:50, Asia

Re: [GENERAL] reducing number of ANDs speeds up query

2013-01-12 Thread Alban Hertroys
On 12 January 2013 12:41, T. E. Lawrence wrote: > Hi and thank you for your notes! > > > You really ought to include the output of EXPLAIN ANALYZE in cases such > as these (if it doesn't already point you to the culprit). > > I'll do so, it takes quite long... > > > Most likely you'll find that t

Re: [GENERAL] reducing number of ANDs speeds up query

2013-01-12 Thread Alban Hertroys
You really ought to include the output of EXPLAIN ANALYZE in cases such as these (if it doesn't already point you to the culprit). Most likely you'll find that the last condition added a sequential scan to the query plan, which can have several causes/reasons. Are the estimated #rows close to the

Re: [GENERAL] Postgresql 9.1 - select statement with multiple "with-clauses" becomes very slow

2013-01-03 Thread Alban Hertroys
You're ending up with something that's basically a carthesian product of closebuildings and closebuildingdescriptions. Your query looks like a simple join would serve just fine, something like: prepare getmydata(real,real,real) AS ( select image, data from info inner join buildings on (buildings.

Re: [GENERAL] PostgreSQL run as process in windows

2013-01-03 Thread Alban Hertroys
FYI: There's a kernel sockets leak in the 64-bit edition of that OS in combination with multiple CPU cores (meaning on any slightly modern CPU). You might be running into that now or later. See: http://support.microsoft.com/?id=2577795 The issue is over a year old and there's still no Windows upda

Re: [GENERAL] Simple Query Very Slow

2012-12-22 Thread Alban Hertroys
u vacuuming that table often enough? If none of that helps, perhaps a REINDEX does. Is that a dedicated database machine or is it also doing other stuff that's eating up resources? You didn't mention what version of Postgres you're on or what OS you're using. Alban Hertroys -

Re: [GENERAL] ERROR: volatile EquivalenceClass has no sortref

2012-11-21 Thread Alban Hertroys
> Ranjeet Dhumal wrote: >> records , am using 9.0.1 version of postgres. This is quite possibly your problem: You're 9 bugfix releases behind on a .0 release. You should be at 9.0.10 at least. -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -- Se

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Alban Hertroys
er_length($1) > 0, false);' LANGUAGE SQL IMMUTABLE; Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Unexplained Major Vacuum Archive Activity During Vacuum

2012-11-02 Thread Alban Hertroys
On 1 Nov 2012, at 17:44, Shaun Thomas wrote: > On 11/01/2012 11:40 AM, Alban Hertroys wrote: > >> Instead of attempting to postpone freeze until beyond the life >> expectancy of our universe, what you probably should have done is >> vacuum more often so that vacuum has le

Re: [GENERAL] Unexplained Major Vacuum Archive Activity During Vacuum

2012-11-01 Thread Alban Hertroys
On 1 November 2012 17:19, Shaun Thomas wrote: > On 11/01/2012 10:28 AM, Kevin Grittner wrote: > Based on my past experience with 8.2, and my understanding of 9.1, I > moved autovacuum_freeze_max_age up to 650M so we'd never get a mid-day > freeze. And the default for vacuum_freeze_table_age is 150

Re: [GENERAL] migrate from PostgreSQL to Oracle

2012-10-25 Thread Alban Hertroys
On 25 October 2012 15:50, jo wrote: > Hi all, > > I'm working with same db schema in PostgreSQL and Oracle, > We mainly work in PostgreSQL but sometimes we need to copy schema and data > from pg to oracle > because some our customers want to use oracle instead of pg. That sounds like a job for an

Re: [GENERAL] Limit+Offset query wrong result in Postgres 9.0.3 ?

2012-10-12 Thread Alban Hertroys
On 12 October 2012 04:55, urkpostenardr wrote: > Hi, > > Is this bug in Postgres ? > If yes, is it fixed in latest release ? > Second query should return 2 rows instead of 1 ? > > create table t(i int); > insert into t values(1); > insert into t values(2); > insert into t values(3); > pgdb=# selec

Re: [GENERAL] pymssql Connection to the database failed for an unknown reason

2012-10-10 Thread Alban Hertroys
>> >> The host name, user, password and database name are all correct. >> Why I get an error? Please help me! >> >> Any suggestion would be highly appreciated! >> >> Best regards, >> Orgil > > Do you solve this

Re: [GENERAL] transitive pruning optimization on the right side of a join for partition tables

2012-09-30 Thread Alban Hertroys
x27;, '4633', '4634', '4635', '4636', '4637', '4638', '4639', > '4640', '4641', '4642', '4643', '4644', '4645', '4646', '4647'); What does EXPLAIN ANALYSE for these queries show? (might take a while, it performs the actual query) My guess is that there will be a large difference in selectivity between both tables for those ID's. Those id's, seeing that you're partitioning on them and they're in a year/week table, do those numbers have some meaning? Or is it perhaps just a daily increment that happens to have some sort of correlation to the date? Without more information, it seems a peculiar column to use for partitioning. It's possible that the issue here is just related to planner statistics, but it's also possible that it's necessary to change your partitioning to aid your BI tools. Another possibility is submitting a case with the people behind that BI software. Alban Hertroys -- The scale of a problem often equals the size of an ego. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Installing uuid-ossp on 9.2

2012-09-30 Thread Alban Hertroys
.so > /usr/local/lib/libuuid.so.16 > /usr/local/lib/libuuid.so.16.0.20 Alban Hertroys -- The scale of a problem often equals the size of an ego. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] problem with recreating database with export

2012-09-27 Thread Alban Hertroys
On 27 September 2012 16:55, Dennis Gearon wrote: > > To anyone reading this in the future, if you have problems importing a plain > text database export, it is usually impossible to do: > psql -d some_dbase -f the_backup.sql. I don't know why. Looks like you forgot -U postgres -- If you can't

Re: [GENERAL] In one of negative test row-level trigger results into loop

2012-09-25 Thread Alban Hertroys
made a programming error that is easy to catch in development (before it reaches production). With Oracle, not so much. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mailing list (pgsql-gene

Re: [GENERAL] Expression to construct a anonymous record with named columns?

2012-09-21 Thread Alban Hertroys
> select * from (values (1, 2, 3)) x (a, b, c); > select x.* from (values (1, 2, 3)) x (a, b, c); And more fun with values: select a, b, c from (values (1, 2, 3), (4, 5, 6), (7, 8, 9)) x (a, b, c); -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-21 Thread Alban Hertroys
t; is useful to an 8-bit encoding. It's not possible to get the byte order wrong in UTF-8, is it? Yes, being able to mark data as being encoded as UTF-8 is useful, but is a BOM the right tool? Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- S

Re: [GENERAL] Expression to construct a anonymous record with named columns?

2012-09-20 Thread Alban Hertroys
(1 as a, 2 as b); select * from (values (1, 2, 3)) a (a, b, c); Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Can a view use a schema search_path?

2012-09-17 Thread Alban Hertroys
On 17 September 2012 11:06, Adam Mackler wrote: > I have the feeling the answer is no, but I would like an authoritative > answer before I give up. > > My plan was to have two schemas: one for the live data, and one for staging, > training, and testing. Both schemas would have identically-named t

Re: [GENERAL] force defaults

2012-09-12 Thread Alban Hertroys
On 12 September 2012 08:49, Willy-Bas Loos wrote: > Hi, > > I want to force deafults, and wonder about the performance. > The trigger i use (below) makes the query (also below) take 45% more time. > The result is the same now, but i do have a use for using the trigger (see > "background info"). >

Re: [GENERAL] Strange problem with string and select

2012-08-30 Thread Alban Hertroys
On 30 August 2012 10:12, Condor wrote: > Hello, > can I ask is exist some kind of automatic escape string in postgresql ? > I use pgsql 9.1.5 and I have very interest problem, I have field with text > string that I cant find normally. > Here is examples (I replace in example Cyrillic encoding bec

Re: [GENERAL] postmaster.pid file auto-clean up?

2012-08-26 Thread Alban Hertroys
you, we may be using PG in an environment that isn't advisable. What you replicated is not what happens when your problem occurs. Processes don't do things like that with each others PID files. What's probably happening in your case is that there's a conflict with another c

Re: [GENERAL] corrupted statistics file "pg_stat_tmp/pgstat.stat"

2012-08-15 Thread Alban Hertroys
On 15 August 2012 09:57, Carl von Clausewitz wrote: > I’ve restored from TAR backup our databases, and everything looked fine. What exactly is in that TAR backup? Is that a tar/gzipped PG dump or a file-system snapshot? If the latter: - did you halt the database while creating the snapshot or at

Re: [GENERAL] Expression alias not recognized in WHERE clause (ERROR: relation "p" does not exist)

2012-08-13 Thread Alban Hertroys
On 13 Aug 2012, at 1:15, Stefan Keller wrote: > 2012/8/9 Alban Hertroys wrote: >> You're referencing "p" as a table, not as a table-alias, because you >> select FROM p. > > That's true but sorry that I can see any difference between > referencing

Re: [GENERAL] Expression alias not recognized in WHERE clause (ERROR: relation "p" does not exist)

2012-08-09 Thread Alban Hertroys
> SELECT b.way AS building_geometry > FROM > (SELECT way FROM osm_polygon > WHERE tags @> hstore('building','yes') > ) AS b, > (SELECT way, tags->'amenity' as value FROM osm_poi > WHERE (tags ? 'amenity') > ) AS p > WHERE > (SELECT count(*) > 1 FROM p > WHERE p.value = 'pharmacy' > A

Re: [GENERAL] Using Insert with case

2012-08-07 Thread Alban Hertroys
lect bob.edge_data.edge_id from bob.edge_data, bob.node, pipe where st_intersects(st_startpoint(bob.edge_data.geom), bob.node.geom) and bob.node.node_id = 415 and pipe.id = 1 and somevariable = 2 Alban Hertroys -- If you can't see the forest for the t

Re: [GENERAL] Threads With Libpq

2012-08-01 Thread Alban Hertroys
} You need a separate connection per thread or you need to synchronise your queries onto the single central connection, meaning that other threads need to be blocked (from performing queries) while any thread is performing a query. Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] BI tools and postgresql

2012-07-29 Thread Alban Hertroys
py to have a chat about the situation and keep an eye out and a direct line to your people open, so that they can hear both sides. He's probably not on their radar right now. Good luck. Whether the same goes for the OP's situation I don't know. It's a lot of guessing

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread Alban Hertroys
b, TRUE AS field, ... FROM sub_1 UNION ALL SELECT 2 AS sub, TRUE AS field, ... FROM sub_2 UNION ALL SELECT 3 AS sub, TRUE AS field, ... FROM sub_3 ) SELECT ... FROM full_set LEFT JOIN subs If you need those rows to be distinct, use UNION instead of UNION ALL, but the database needs to d

Re: [GENERAL] Select Rows With Only One of Two Values

2012-07-20 Thread Alban Hertroys
related subquery: SELECT DISTINCT param FROM table t1 WHERE indicator = 0 AND NOT EXISTS (SELECT 42 FROM table t2 WHERE t2.param = t1.param AND indicator <> 0) (Where 42 is just some placeholder value because the syntax requires it, any value will do but NULL might throw a spanner in the

Re: [GENERAL] [BUGS] main log encoding problem

2012-07-19 Thread Alban Hertroys
On 19 July 2012 13:50, Alexander Law wrote: >> I like Craig's idea of adding the client encoding to the log lines. A >> possible problem with that (I'm not an encoding expert) is that a log >> line like that will contain data about the database server meta-data >> (log time, client encoding, etc)

Re: [GENERAL] [BUGS] main log encoding problem

2012-07-19 Thread Alban Hertroys
Yikes, messed up my grammar a bit I see! On 19 July 2012 10:58, Alban Hertroys wrote: > I like Craig's idea of adding the client encoding to the log lines. A > possible problem with that (I'm not an encoding expert) is that a log > line like that will contain data about the d

Re: [GENERAL] [BUGS] main log encoding problem

2012-07-19 Thread Alban Hertroys
On 19 July 2012 10:40, Alexander Law wrote: >>> Ok, maybe the time of real universal encoding has not yet come. Then >>> we maybe just should add a new parameter "log_encoding" (UTF-8 by >>> default) to postgresql.conf. And to use this encoding consistently >>> within logging_collector. >>> If thi

Re: [GENERAL] Trouble with NEW

2012-07-18 Thread Alban Hertroys
umn named fluid_id. > > Can we see the table schema. What I am looking for is quoted column name > that would preserve case. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest. -- Sent via pgsql-general mail

Re: [GENERAL] Chicken/egg problem with range types

2012-07-18 Thread Alban Hertroys
On 18 Jul 2012, at 16:15, Tom Lane wrote: > Alban Hertroys writes: >> On 18 Jul 2012, at 5:08, Tom Lane wrote: >>> I wonder whether we could improve this by postponing the no-shell-types >>> check from creation to function runtime. > >> I don't suppose i

Re: [GENERAL] installation problem with postgres password

2012-07-18 Thread Alban Hertroys
On 18 July 2012 10:33, KOTa wrote: > update. managed to run it via command prompt "postgres_install.exe > --serviceaccount postgres" > it did start. it still asks for a password, but because i could not > create any password for this user and installation does not accept > empty password, i am sti

Re: [GENERAL] Chicken/egg problem with range types

2012-07-18 Thread Alban Hertroys
dded. I don't suppose it'd be possible to treat it as a deferred constraint? Then the check would be moved to the end of the transaction. Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- Sent via pgsql-general mailing list (pgsql-general@postg

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Alban Hertroys
On 16 Jul 2012, at 17:57, Daniele Varrazzo wrote: > On Mon, Jul 16, 2012 at 3:56 PM, Craig Ringer wrote: >> On 07/16/2012 07:41 PM, Alban Hertroys wrote: >>>>> >>>>> BTW, that second value looks a whole lot like a poorly thought out > >> Yup.

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