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

2012-07-16 Thread Alban Hertroys
>> BTW, that second value looks a whole lot like a poorly thought out >> substitute for 'infinity' ... >> regards, tom lane > > That's certainly an interesting comment and I'm open to suggestions! The > original db has two columns (from_timestamp, to_timestamp). I don't go f

Re: [GENERAL] ERROR: function crosstab(unknown, unknown) does not exist

2012-07-05 Thread Alban Hertroys
> Per Toms suggestion you need to check the permissions on the schema. > One way to do that is, from psql type the following and enter: > \dn+ One other thing you might want to verify: Does user XXX have the PUBLIC schema in their search_path? It is by default, but some people take it out for sec

Re: [GENERAL] Query ordering question

2012-07-02 Thread Alban Hertroys
ere the numbers have varying amount of leading space perhaps? 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] Conversion of columns during CSV Import

2012-06-29 Thread Alban Hertroys
(foreign data wrappers) present data from foreign sources (such as a CSV file) as a table inside the database. Once you have that, it should be fairly easy to craft an INSERT ... SELECT that converts the data on the fly. Or use an ETL tool - Pentaho is popular. Alban Hertroys -- If you can

Re: [GENERAL] create database from template requires the source database to be unused

2012-06-28 Thread Alban Hertroys
> I've read that postgres uses MVCC for transactions, and that it creates > snapshots of the database for each transaction.  Couldn't the create > database command just use that snapshot? Database creation cannot be done inside a transaction (one of the few DDL statements that can't), so no. --

Re: [GENERAL] create database from template requires the source database to be unused

2012-06-27 Thread Alban Hertroys
tgresql.org/docs/9.1/static/manage-ag-templatedbs.html 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] dblink causing import errors

2012-06-26 Thread Alban Hertroys
On 26 June 2012 10:59, Christoph Zwerschke wrote: > Our developers like the dblink modules, so I have installed it into the > template1 database. They also like to import old database dumps after > creating new databases with dbcreate. But then they get irritated by the > error messages saying tha

Re: [GENERAL] Help, server doesn't start

2012-06-25 Thread Alban Hertroys
> Yes, pg_dump output from 8.3 should restore fine to 9.1. Pardon my ignorance if this changed in recent versions, but shouldn't that read: Yes, pg_dump 9.1 output from 8.3 should restore fine to 9.1? -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest.

Re: [GENERAL] pg_dump not dumping all tables

2012-06-22 Thread Alban Hertroys
On 22 June 2012 10:45, Stefan Schwarzer wrote: > Hi there, > > I am pg_dump-ing all tables from schema public on the server > >       /usr/local/pgsql/bin/pg_dump -U user my_database --schema=public > --encoding=UTF-8 > dump.sql > > and re-loading it via psql on my local machine. > > But instead

Re: [GENERAL] pgstat wait timeout : permission denied

2012-06-19 Thread Alban Hertroys
> 2012-06-19 09:33:38 CESTWARNING:  01000: pgstat wait timeout > 2012-06-19 09:33:38 CESTLOCATION:  backend_read_statsfile, > .\src\backend\postmaster\pgstat.c:3807 > 2012-06-19 09:33:41 CESTLOG:  42501: could not rename temporary statistics > file "pg_stat_tmp/pgstat.tmp" to "pg_stat_tmp/pgstat.st

Re: [GENERAL] Starting a cluster as a service

2012-06-18 Thread Alban Hertroys
On 18 June 2012 09:46, Léa Massiot wrote: > Hello Thomas, > Contrary to what you say, I provided command lines and messages (in case of > failure). > What is missing according to you? The command lines. If you did indeed post them, they did not make it to the list. -- If you can't see the fores

Re: [GENERAL] Submit query using dblink that hung the host

2012-06-15 Thread Alban Hertroys
ay you can perform the query in one database, which will only have to move the rows needed for the end result. I also notice that you don't use any data from the local database in that query at all. Perhaps you could query the database on port 4001 instead? That would seem to make mor

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Alban Hertroys
On 12 June 2012 14:21, Stefan Schwarzer wrote: > But the "make" process gives me this: > > cd contrib/tablefunc > tablefunc $ make > gcc -Os -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk I think that's where it looks for the standard C headers? In that case that's what you need to change.

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Alban Hertroys
On 13 June 2012 15:12, Alexander Farber wrote: > And when I split my statements into multiple > prepare()/execute() or query() calls, > then the temp. tables aren't found anymore. Did you remember to wrap them in a transaction like you did in your prepared statement? -- If you can't see the for

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Alban Hertroys
SELECT * FROM "B" WHERE "Id" = $1; Positional parameters -^^ You can't mix those. I don't think SQL functions support named parameters, so using positional parameters throughout would be the solution. Alban Hertroys -- If you

Re: [GENERAL] import *.backup-file (PostGIS - not mine)

2012-06-11 Thread Alban Hertroys
On 11 June 2012 10:42, gipsy-king1 wrote: > I have to import and watch/edit data stored in an .backup-file. This is a > backup-file, stored by an other firm. > Can you tell me what I have to do? Is that a Postgres dump? If so, is it a plain text dump, a compressed dump or a custom format dump?

Re: [GENERAL] pg_database_size differs from df -s

2012-06-06 Thread Alban Hertroys
On 6 Jun 2012, at 16:33, Frank Lanitz wrote: > the result is much bigger than running a df -s over the postgres folder > - Its about factor 5 to 10 depending on database. Is your du reporting sizes in Bytes or blocks or ...? Alban Hertroys -- The scale of a problem often equals the size

Re: [GENERAL] problem after upgrade db missing

2012-06-06 Thread Alban Hertroys
On 5 June 2012 23:51, Aleksander Rozman wrote: > Like I said before all databases were missing... One of thoose database was > very important, but since I didn't have time I didn't pursue it further. If it was very important, that means that you have backups, right? >From the other replies it see

Re: [GENERAL] Updateable Views or Synonyms.

2012-05-30 Thread Alban Hertroys
database for some reason or another. You can create updateable views by adding INSERT, UPDATE and DELETE rules to them. 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 subscr

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Alban Hertroys
On 29 May 2012 14:58, Adrian Klaver wrote: > Q: Why can't I reload the SQL script I dumped in the SQL window? > > A: The following limitations currently exist in SQL script execution: > >        * 'psql' commands such as '\connect' will not work at all. Wait a minute! They use the pg_dump utility

Re: [GENERAL] enhanced linestyles for psql

2012-05-24 Thread Alban Hertroys
On 24 May 2012 15:33, Pavel Stehule wrote: > hello > > I wrote patch for PostgreSQL 9.1 and 9.2 that adds more linestyles and > border styles to console Nice job! I'm not entirely enthusiastic about the option names though. Would it help to split the setting into several? For example: \pset bord

Re: [GENERAL] UDF in C slow

2012-05-11 Thread Alban Hertroys
On 11 May 2012 15:57, Inanc Seylan wrote: > Hi all, > > I have implemented a user-defined function in C that returns a boolean value > after some computation. Now I have a query Q such that when I specify the > function in the WHERE clause of Q, Q runs in 40 secs and if I don't use the > function

Re: [GENERAL] Prepared statements performance

2012-05-10 Thread Alban Hertroys
On 10 May 2012 15:05, Radosław Smogura wrote: > May I ask what kind of planning may occur during insert? Well, for example, if there's a unique constraint on the table then the database will have to check that the newly inserted values don't conflict with values that are already in the table. It

Re: [GENERAL] Prepared statements performance

2012-05-10 Thread Alban Hertroys
On 10 May 2012 11:30, Daniel McGreal wrote: > I put the multi-value inserts in as I was > curious as to why prepared statements would be slower given they only plan > the query once (as also does the multi-value insert, I assume). That's a common misconception. The reason that prepared statement

Re: [GENERAL] FATAL: lock file "postmaster.pid" already exists

2012-05-08 Thread Alban Hertroys
ng the > PID file > manually each time the server complains about this? You could probably script removal of the pid file if its creation date is before the time the system started booting up. Alban Hertroys -- The scale of a problem often equals the size of an ego. -- Sent via pgsql-gene

Re: [GENERAL] Memory Management in pqlib, Garbage Collection support

2012-05-03 Thread Alban Hertroys
On 3 May 2012 09:39, Alexander Reichstadt wrote: > Thanks, that's answering my question. In Objective-C as well as many other I notice that you're talking about pqlib instead of libpq. Perhaps pqlib is an Obj-C wrapper around libpq that most of us just don't know about? Obj-C is not a particularl

Re: [GENERAL] new rows based on existing rows

2012-05-02 Thread Alban Hertroys
value you want into that column, > thus making it available to the RETURNING clause. I was wondering, would an updatable view with a "pseudo-column" for the old_id do it? Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- Sent via pgsql-gene

Re: [GENERAL] Re: how to set up automatically startup database when the server boot or reboot.

2012-04-27 Thread Alban Hertroys
On 27 April 2012 16:47, leaf_yxj wrote: > David, Thanks for your reminder. My database version is 8.2.15. And My os > platform is Linux 5.5.  Thanks I really appreciate it. Grace There is no such thing as Linux 5.5. But since you're on _a_ Linux distribution (there are many), you'll probably fin

Re: [GENERAL] Simple way to get missing number

2012-04-24 Thread Alban Hertroys
On 24 April 2012 16:15, Emi Lu wrote: > Good morning, > > May I know is there a simple sql command which could return missing numbers > please? > > For example, > > t1(id integer) > > values= 1, 2, 3 500 > > select miss_num(id) > from   t1 ; > > > Will return: > === > 37, 800,

Re: [GENERAL] Performance degrades until dump/restore

2012-04-19 Thread Alban Hertroys
On 19 April 2012 16:09, Chris wrote: > Hi Chris, > It is postgres 9.1, with default settings.  The autovacuum settings are all > commented out, I have not change dthem. My understanding is that analyze is > also run automatically by default. > > So, I believe the answer to both questions is 'Yes'.

Re: [GENERAL] problem with serial

2012-04-19 Thread Alban Hertroys
On 19 April 2012 16:19, Yvon Thoraval wrote: > why ? Because you're doing it wrong, apparently. However, since you left out all the relevant information that could have helped determining what you're doing and what errors you got, we can't help you. Please provide the entire insert statement and

Re: [GENERAL] remove some rows from resultset

2012-04-19 Thread Alban Hertroys
b1.org_specific_rule = true group by b1.org_id, b1.contract_name order by b1.org_id, b1.contract_name; 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 subscri

Re: [GENERAL] Result sets from functions

2012-04-16 Thread Alban Hertroys
On 16 April 2012 09:24, Liam Caffrey wrote: > Hi, > > There is a feature that I have used in SQL Server which I find really useful > for debugging (without using a debugger!!). > It is this I can write multiple "select * from some_table" statements > throughout my stored procedure (here read "

Re: [GENERAL] Updating pg_attribute to change field's data type from integer to bigint on very large table

2012-04-14 Thread Alban Hertroys
going to experiment with this, you should really try it on a separate database (preferably on a different server) with some test data first. There's definitely a risk of losing everything in the database. It's probably a _really_ bad idea :P Alban Hertroys -- The scale of a problem of

Re: [GENERAL] Searchable chess positions in a Postgress DB

2012-04-11 Thread Alban Hertroys
On 11 April 2012 09:15, Sidney Cadot wrote: > Dear all, > > As a hobby project, I am toying around with a database containing > about 5 million chess games. On average, these games have about 80 > positions (~ 40 moves by both black and white), which means there are > about 400 million chess posit

Re: [GENERAL] Please help me to take a look of the erros in my functions. Thanks.

2012-04-02 Thread Alban Hertroys
L-CURSOR-FOR-LOOP > CASCADE;'; > ELSE > The tablename doesn't exist.doesn > END IF ; > END; > $$ LANGUAGE 'plpgsql' security definer; Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you&#x

Re: [GENERAL] Please help me to take a look of the erros in my functions. Thanks.

2012-04-02 Thread Alban Hertroys
a's. Of course, that may not be applicable to the her situation. 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/m

Re: [GENERAL] user get notification when postgresql database updated

2012-03-30 Thread Alban Hertroys
ve a push mechanism, so you can't notify your browser-based application from your server. You will have to poll. Googling for "ajax push" turned up this explanation: http://www.subbu.org/blog/2006/04/dissecting-ajax-server-push Alban Hertroys -- The scale of a problem often equals

Re: [GENERAL] default value returned from sql stmt

2012-03-30 Thread Alban Hertroys
anum, 0 from t1 where anum = 4 union all select 100, 1 limit 1 order by 2; If you don't want the extra column in your query results, you can wrap the query in another select. 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] why is pg_dump so much smaller than my database?

2012-03-29 Thread Alban Hertroys
On 29 March 2012 09:11, John R Pierce wrote: > On 03/28/12 10:32 PM, Carson Gross wrote: >> >> I've got a pretty big database (~30 gigs) and when I do a pg_dump, it ends >> up only being 2 gigs. I suppose you're talking about a plain text dump here? A compressed dump would likely[*] be quite a bi

Re: [GENERAL] Facing error while restoring the database

2012-03-27 Thread Alban Hertroys
On 27 March 2012 15:12, Akshay Joshi wrote: > On Tue, Mar 27, 2012 at 6:15 PM, Alban Hertroys wrote: >> >> On 27 March 2012 11:33, Akshay Joshi >> wrote: >    pg_restore: restoring data for table "sample" >    pg_restore: [archiver (db)] Error while PROCE

Re: [GENERAL] Facing error while restoring the database

2012-03-27 Thread Alban Hertroys
On 27 March 2012 11:33, Akshay Joshi wrote: > Hi > > I am facing issue while restoring the database. I have taken the backup of > my database using pg_dump and then create new database and try to restore it > using pg_restore. I am using PostgreSQL 9.0. What is the error? It looks like you are t

Re: [GENERAL] loading a function from a file

2012-03-26 Thread Alban Hertroys
On 26 March 2012 11:32, and wrote: > I have read it on logging > psql -h host database <  create_some_func.sql > but then i am forced to redo the login.Is there another way to do it? If you're working on the database server, then you can skip the "-h host" bit and use a socket. That does require

Re: [GENERAL] plpgsql function to insert or update problem

2012-03-24 Thread Alban Hertroys
quot;if not found" seem > to work? Any hints would be appreciated. You forgot about vid in your PK ;) 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@po

Re: [GENERAL] A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?

2012-03-17 Thread Alban Hertroys
s less rows per > page on the slave.) I recall someone in here had a similar problem where the table's FILLFACTOR on the slave was different from the one on the master. Perhaps that would explain the gaps you're seeing? Alban Hertroys -- Screwing up is an excellent way to attach s

Re: [GENERAL] A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?

2012-03-16 Thread Alban Hertroys
orm the CLUSTER on the new TABLESPACE and then move it back. 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] Problem for restoure data base Postgre

2012-03-16 Thread Alban Hertroys
an old version of pg_restore to attempt the restore. CREATE EXTENSION is new to Postgres 9.x, so your pg_restore is probably from a Postgres 8.x installation. Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -- Sent via pgsql-general mailing list (pgsql

Re: [GENERAL] A 154 GB table swelled to 527 GB on the Slony slave. How to compact it?

2012-03-12 Thread Alban Hertroys
On 12 March 2012 09:20, Nur Hidayat wrote: > FYI, after I changed text field into character varying, I vaccuum the whole > database, resulting in much smaller database size What I think that happened in your case is that because of the data-type change every row in the table got rewritten to a n

Re: [GENERAL] Re: One transaction by connection - commit subdetails without release master transaction?

2012-02-29 Thread Alban Hertroys
aneously_. You can serialise transactions on one connection just fine. 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] A better COPY?

2012-02-26 Thread Alban Hertroys
t to do that. Use COPY from STDIN and supply the contents of the file after that. 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/ma

Re: [GENERAL] Optimise PostgreSQL for fast testing

2012-02-24 Thread Alban Hertroys
low. With that knowledge you may be able to speed them up (often significantly). And look into parallelising that workload. PG was designed for parallel workloads. Using a single process you're still paying for that and not benefitting. Alban Hertroys -- Screwing up is an excellent way to attac

Re: [GENERAL] MySQL search query is not executing in Postgres DB

2012-02-17 Thread Alban Hertroys
On 17 February 2012 17:19, Scott Marlowe > Have you tried casting to varchar(1000) or something like that? Don't MySQL's varchars only go to 255? That's why every MySQL database uses blobs for text data, isn't it? -- If you can't see the forest for the trees, Cut the trees and you'll see there i

Re: [GENERAL] How to write in Postgres

2012-02-07 Thread Alban Hertroys
On 7 February 2012 15:03, wrote: > How do I convert this to PostGres. I'm getting a error > ERROR: syntax error at or near "(" > LINE 23: set chr = substr(lfeid,idx,1); > Assuming you are writing this as pl/pgsql code, the way you do your variable assignments is wrong on two accounts. Find some

Re: [GENERAL] Error while importing CSV file

2012-02-07 Thread Alban Hertroys
On 7 February 2012 06:43, Lockas wrote: > OK .. my offending line number is 4533 > How can i remove it while copying ? You can remove it before copying or after, but not while. -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -- Sent via pgsql-gen

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Alban Hertroys
On 6 February 2012 13:26, Lockas wrote: > * > ok then if I want to except that row from copying. how i can write it ?* You can either remove the offending line(s) from the csv file or copy to a staging table that doesn't have those limitations on field lengths first. -- If you can't see the for

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Alban Hertroys
On 6 February 2012 07:37, Lockas wrote: > I've tried a lot of sizes > but I still have messages in my log saying: > > *  --- >  ERROR:  value too long for type character varying(200) >  --- * > > Why is this? There are no other varchar(200) columns in my DB at all, > no other table. Only this colu

Re: [GENERAL] Why this regexp matches?!

2012-02-04 Thread Alban Hertroys
docs do mention a known limitation with braces and forward-references - maybe this is related. 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] Help speeding up a left join aggregate

2012-01-31 Thread Alban Hertroys
id = sd.advertisement_id AND a.advertiser_id = sd.advertiser_id WHERE advertiser_id = 6553406 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] [RFE] auto ORDER BY for SELECT

2012-01-24 Thread Alban Hertroys
On 24 January 2012 09:29, Chris Angelico wrote: > On Mon, Jan 23, 2012 at 11:17 PM, Douglas Eric wrote: >> I suggest to change this behavior. If one makes a SELECT statement without >> any ORDER BY, it would be >> clever to automatically sort by the first primary key found in the query, if >> any

Re: [GENERAL] update with from

2012-01-23 Thread Alban Hertroys
On 23 January 2012 14:48, Sim Zacks wrote: >> In my tests, if the joined rows are sorted it always updates with the >> first row. Does anyone have any other experiences, or should I be >> concerned that at some point it will behave differently? > > I checked my tests again. It always uses the last

Re: [GENERAL] Update takes longer than expected

2012-01-10 Thread Alban Hertroys
On 10 January 2012 15:46, Jerry Sievers wrote: >> We're trying to migrate the app from mysql to pg and this is one of >> the performance bottle-necks.  Unfortunately it slows down every >> request by about 5 seconds. That's a delay that could be due to DNS problems or other network issues. It may

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-09 Thread Alban Hertroys
wn type (typically from a column) or once it gets cast to a type explicitly. If that never happens, I expect that the literal will not be converted to any type and stay the text value that it was in the SQL query string. This is probably documented, but I don't have time to di

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-09 Thread Alban Hertroys
On 9 January 2012 14:55, Radosław Smogura wrote: > So responsible for this is database, but database doesn't have > "real" BLOBs, this what is made in PG JDBC driver is just "not perfect" way > to add this functionality to PostgreSQL. I think you should elaborate on what you mean when you say tha

Re: [GENERAL] Supporting SQL/MED DATALINK

2012-01-09 Thread Alban Hertroys
On 9 January 2012 12:36, John R Pierce wrote: > On 01/09/12 3:07 AM, Alban Hertroys wrote: >>> >>> For the record, it looks like MS SQL Server has some equivalent feature : >>> >  FILESTREAM. >> >> And Oracle has BFILE. > > aren't th

Re: [GENERAL] Supporting SQL/MED DATALINK

2012-01-09 Thread Alban Hertroys
On 9 January 2012 09:56, Damiano ALBANI >> I believe DB2 is pretty much it in this area. > > For the record, it looks like MS SQL Server has some equivalent feature : > FILESTREAM. And Oracle has BFILE. I've actually been thinking about how to implement something like this for Postgres, but the i

Re: [GENERAL] JOIN column maximum

2012-01-08 Thread Alban Hertroys
to combine tables that the Census Bureau didn't combine for them. Things like "how much do female Asians make compared to their mobility". Alban Hertroys -- The scale of a problem often equals the size of an ego. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] Duplicated entries are not ignored even if a "do instead nothing" rule is added.

2012-01-04 Thread Alban Hertroys
You accidentally clicked "Reply" instead of "Reply-all" ;) On 4 Jan 2012, at 3:03, 邓尧 wrote: >> On Tue, Jan 3, 2012 at 3:42 PM, Alban Hertroys wrote: >> On 3 Jan 2012, at 5:20, 邓尧 wrote: >> >> > Hi, >> > >> > I'm new to

Re: [GENERAL] Duplicated entries are not ignored even if a "do instead nothing" rule is added.

2012-01-02 Thread Alban Hertroys
e) SELECT DISTINCT home FROM staging_table WHERE NOT EXISTS (SELECT 1 FROM account WHERE account.home = staging_table.home); Other options are to use external tools written for batch inserting large amounts of data. I seem to recall pgfouine is such an application, but I've never used it. A

Re: [GENERAL] Large Objects and and Vacuum

2012-01-02 Thread Alban Hertroys
On 31 December 2011 00:54, Simon Windsor wrote: > I am struggling with the volume and number of XML files a new application is > storing. The table pg_largeobjects is growing fast, and despite the efforts > of vacuumlo, vacuum and auto-vacuum it keeps on growing in size I can't help but wonder wh

Re: [GENERAL] Verifying a timestamp is null or in the past

2011-12-30 Thread Alban Hertroys
clause will treat it as false. That's one of the peculiarities of SQL... For posterity's sake it may be better to add that part to the query anyway, that's up to personal preference: select 1 from pref_users where id=_from and (vip is not null or vip > current_timestamp +

Re: [GENERAL] Error while loading sql file

2011-12-26 Thread Alban Hertroys
nasty problem you ran into, I hope the archives provide the wisdom you need. 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] PostgreSQL DBA in SPAAAAAAAACE

2011-12-24 Thread Alban Hertroys
x27;m surprised he/we won too. I consider it a compliment :) Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll see there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http:/

Re: [GENERAL] postgresql triggers - defining a global resource (java)

2011-12-24 Thread Alban Hertroys
probably boils down to the same, but closer to kernel-level). If your PG is pre-9, then you'll want some mechanism that keeps a pool of pending data for RPC. In 9.0 and up you can send record information along with NOTIFY. Alban Hertroys -- The scale of a problem often equals the siz

Re: [GENERAL] design help for performance

2011-12-20 Thread Alban Hertroys
CASCADE ON DELETE CASCADE, table_b_rowcount int NOT NULL DEFAULT 0 ); Yes, those cascades are on purpose - the data in C is useless without the accompanying record in A. Also, the PK makes sure it stays a 1:1 relationship. Alban Hertroys -- Screwing up is an excellent way to attach something to the ceiling. -

Re: [GENERAL] PostgreSQL DBA in SPAAAAAAAACE

2011-12-20 Thread Alban Hertroys
On 20 December 2011 16:01, Merlin Moncure wrote: > On Tue, Dec 6, 2011 at 10:56 AM, Joe Miller wrote: > guess who won! :-D Ah cool. I'll wave when I get outside :) -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -- Sent via pgsql-general mailing

Re: [GENERAL] pg_restore should restore the schema comments and the database properties

2011-12-20 Thread Alban Hertroys
On 20 December 2011 15:35, Adrian Klaver wrote: > To elaborate on my previous answer, search_path is in postgresql.conf because > it > is tied to the database cluster not a particular database. Not necessarily, it can also be tied to a schema or a role or (I assume) a specific database in the cl

Re: [GENERAL] Changing Passwords as Encrypted not Clear-Text

2011-12-19 Thread Alban Hertroys
> Of course, we could create login credentials, login configuration options > for every DBA colleagues. But, as I said previous that big problem is > "PostgreSQL logs include changing passwords on clear-text not encrypted" No, the big problem is that you don't consider your fellow DBA's reliable.

Re: [GENERAL] Changing Passwords as Encrypted not Clear-Text

2011-12-19 Thread Alban Hertroys
On 19 December 2011 16:26, MURAT KOÇ wrote: > Hi Adrian, > > I wrote a desktop application on Windows by using "Npgsql.dll". So, I send > SQL statement to database from this application code. I can't use psql > command line (I know "\password" command changes password encrypted text). > > Because

Re: [GENERAL] Correct syntax to create partial index on a boolean column

2011-12-14 Thread Alban Hertroys
(RecipeId, diet_glutenfree), except that the latter also contains entries that are not gluten-free of course. 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] Controlling complexity in queries

2011-12-14 Thread Alban Hertroys
ufficient - no need to check whether there are other matches after the first one. That said, wouldn't a foreign key constraint help you even better? If questions.user_id is required to refer to an existing users.id (by an FK constraint), than the check in the query becomes moot. 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] [pgadmin-support] Help for Migration

2011-12-07 Thread Alban Hertroys
On 7 December 2011 10:08, wrote: > The procedure definition is > CREATE OR REPLACE PROCEDURE > -- So I am not calling a function but a procedure. I don't think CREATE PROCEDURE is actually a valid command in Postgres. The 9.0 documentation seems to confirm that (http://www.postgresql.org/docs/9

Re: [GENERAL] How to retrieve rows with empty value in numeric(12,8) columns

2011-12-06 Thread Alban Hertroys
On 6 December 2011 12:00, Adarsh Sharma wrote: >> select * from table where lat IS NULL; > can you explain how it works or any link that explain the difference between > 2 queries. That's because of the 3-valued logic of SQL. x=NULL always evaluates to NULL, because it is unknown whether the t

Re: [GENERAL] Weird behavior: deleted row still in index?

2011-12-04 Thread Alban Hertroys
t id there. Perhaps there's a DELETE trigger or rule on this table that does something unexpected? It is indeed a possibility that this is a corrupted index, but that is not something that happens unless more serious matters have been (or are) at hand, like hardware failures. Alban Hertroy

Re: [GENERAL] Foreign keys question (performance)

2011-12-04 Thread Alban Hertroys
ew; there can't be a reference. UPDATEs and DELETEs do though, whether you let them CASCADE or not. If you don't, then the database raises a foreign key constraint violation. If you do, then it needs to modify the relevant rows in the child table. Likewise, INSERTs and UPDATEs in the child

Re: [GENERAL] Conditional left join

2011-12-01 Thread Alban Hertroys
On 1 December 2011 13:16, Amitabh Kant wrote: > I am trying (through conditional left join?) to fetch all records of tbldata > and the operator name from tbloperators who was operating the unit at event > time. If no operator was present, it should return null. I think you want something akin to:

Re: [GENERAL] Stored function debugging help

2011-11-28 Thread Alban Hertroys
On 28 November 2011 13:36, JavaNoobie wrote: > Well I'm not fond of using a temporary table either. But how would I be able > to iterate over a set of consumers while using a join ? From my (limited) , > using only a join I would only be able to generate the data for a particular > consumer , rath

Re: [GENERAL] Reassign value of IN parameter in 9.1.1

2011-11-24 Thread Alban Hertroys
On 24 November 2011 14:52, Gavin Casey wrote: > This works in 9.1.1 but seems like a bug to me: > > create function xout(_x INTEGER) > returns integer > as $$ > begin >    _x = _x * 2; I would expect an error here, as having an expression without a context (an if-statement, for example) should be

Re: [GENERAL] How to lock and unlock table in postgresql

2011-11-16 Thread Alban Hertroys
that sequences solve. You could also get the id using INSERT .. RETURNING. You have another problem on your hands though. You have a naming conflict between your variable name and a column name in that second query: id and Id are the same. Alban Hertroys -- Screwing up is an excellent way to att

Re: [GENERAL] : Postgres installation error on CentOS

2011-11-15 Thread Alban Hertroys
On 15 November 2011 12:58, Venkat Balaji wrote: > Hello, > We are facing an issue while installing Postgres-9.0.1 on CentOS-5. That name always makes me wonder when they're releasing PennyOS or DollarOS :P > Below is the error we are encountering - > ./configure -- output > checking for inflate

Re: [GENERAL] Returning a row from a function with an appended array field

2011-11-10 Thread Alban Hertroys
use a self-join. SELECT parent.id AS parent_id, child.id as child_id FROM thingy AS parent LEFT OUTER JOIN thingy AS child ON (child.parent_id = parent.id) 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] troubleshooting PGError

2011-11-10 Thread Alban Hertroys
roll back to an earlier savepoint and continue from there. You really should read the relevant documentation at: http://www.postgresql.org/docs/8.3/static/tutorial-transactions.html P.S. Please don't top-post on this list. P.P.S. And please include the list in your replies (reply all). > On

Re: [GENERAL] troubleshooting PGError

2011-11-10 Thread Alban Hertroys
On 9 November 2011 06:02, slavix wrote: > Hello, > I am new to postgres, but need to resolve this error: > > PGError: ERROR:  current transaction is aborted, commands ignored > until end of transaction block > : SELECT  1 FROM "trades"  WHERE ("trades"."uuid" = > 'bc8d86e6-0a8d-11e1-a345-001d09203

Re: [GENERAL] How to inquiry a nest result?

2011-11-10 Thread Alban Hertroys
On 10 November 2011 15:43, shuaixf wrote: > --*Test SQL* > CREATE TABLE tb(id integer primary key, >                name varchar(32), >                parent integer); > > INSERT INTO tb VALUES(1, 'iPhone',    NULL); > INSERT INTO tb VALUES(2, 'HTC',       NULL); > INSERT INTO tb VALUES(3, 'Motoro

Re: [GENERAL] dll files missing in postgrsql bin folder in Windows

2011-11-10 Thread Alban Hertroys
On 10 November 2011 08:56, Kalai R wrote: > please suggest, what are the configurations should I do in postgres to avoid > these problem. > Thank You None, it's not a Postgres problem. Most likely it is a problem with your Windows installation. You have files disappearing, something is doing that

Re: [GENERAL] Returning a row from a function with an appended array field

2011-11-10 Thread Alban Hertroys
On 10 November 2011 02:54, Wes Cravens wrote: > On 11/9/2011 7:34 PM, David Johnston wrote: >> Use "WITH RECURSIVE" instead of a function. >> > > I apologize but I don't know how that would work.  An example would help. There are fine examples in the documentation for the SELECT statement. -- I

Re: [GENERAL] Strange problem with create table as select * from table;

2011-11-03 Thread Alban Hertroys
On 3 November 2011 09:25, hubert depesz lubaczewski wrote: > All looks good. pg_dump of the table also doesn't show any strange problems, > and is duplicate free. But: > > $ create table zzz as select * from sss.xobjects; > SELECT > > $ select xobject_id, count(*) from zzz group by 1 having c

Re: [GENERAL] Strange problem with create table as select * from table;

2011-11-03 Thread Alban Hertroys
On 3 November 2011 15:15, hubert depesz lubaczewski wrote: >> Do the xobject_id values have other negative numbers or is -1 just a special >> case? The only thing I can think of is a corrupted index on xobject_id. > > minimal xobject_id in source table is 1000. > > index on xobject_id might be cor

Re: [GENERAL] Why is there no 8.3.16 rpm with _id ?

2011-10-31 Thread Alban Hertroys
2011/10/30 Devrim GÜNDÜZ : > > I have no intention to build the -id packages again, given the lack of > request (first request since 8.3.11...). You can build your own packages > quite easily, though. But... aren't integer datetimes supposed to be the default, with float datetimes quickly becoming

Re: [GENERAL] From select to delete

2011-10-29 Thread Alban Hertroys
ble > "pref_scores" DETAIL: Key (gid)=(1998) is still referenced from table > "pref_scores". CONTEXT: SQL statement "delete from pref_games where > gid in (select gid from pref_scores where id= $1 )" It would without cascades defined, yeah. Did you skip ov

Re: [GENERAL] From select to delete

2011-10-28 Thread Alban Hertroys
le, or list of scalar > variables following INTO. > CONTEXT: compilation of PL/pgSQL function "pref_delete_user" near line 3 SELECT INTO in PL/pgSQL isn't the same command as SELECT INTO in SQL. Check the documentation for the two ;) Alban Hertroys -- Screwing up is an

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