[GENERAL] DELETE with LIMIT - workaround?

2013-06-27 Thread Chris Angelico
because it does make good sense to do this in a single pass rather than fetching some kind of unique identifier and then re-locating by that. But is the ctid somehow magical in being actually fast/simple enough to not care about the difference? Chris Angelico -- Sent via pgsql-general mailing list

Re: [GENERAL] coalesce function

2013-06-20 Thread Chris Angelico
On Fri, Jun 21, 2013 at 7:36 AM, David Johnston wrote: > SELECT input > FROM ( SELECT unnest($1) AS input ) src > WHERE input IS NOT NULL AND input <> '' > LIMIT 1; Does this guarantee the order of the results returned? Using LIMIT without ORDER BY is something I'v

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 12:34 PM, Amit Langote wrote: > On Thu, Jun 20, 2013 at 11:10 AM, Chris Angelico wrote: >> On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote >> wrote: >>> Umm, my bad! I almost forgot I could write pure SQL function bodies. >>> Although,

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 12:09 PM, Amit Langote wrote: > Umm, my bad! I almost forgot I could write pure SQL function bodies. > Although, why does following happen? (sorry, a 8.4.2 installation) : > > postgres=# create or replace function gt(n int, m int) returns boolean > as 'select n>m' language

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:35 AM, Amit Langote wrote: > On Thu, Jun 20, 2013 at 10:27 AM, Chris Angelico wrote: >> If your wrapper function is written in SQL and is trivial (eg ignore >> the third parameter and pass the other two on), the planner should be >> able to opti

Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-19 Thread Chris Angelico
On Thu, Jun 20, 2013 at 11:10 AM, Amit Langote wrote: > If this particular function is to be used repeatedly in a single > query, would the cost of having a wrapper function around the original > function be too large? For example, if this function appears in a > WHERE clause against a table conta

Re: [GENERAL] Using a CTE for an update

2013-05-31 Thread Chris Angelico
On Sat, Jun 1, 2013 at 7:37 AM, David Salisbury wrote: > > I would think this would be possible. I'm on 9.0.8 > > I have a reference between two tables, and want to populate a field in one > table > with a value that's in the referenced table ( based on the FK reference of > course ). > > with ro

Re: [GENERAL] Introduction

2013-05-30 Thread Chris Angelico
On Thu, May 30, 2013 at 6:02 AM, Corbett, James wrote: > For those twenty years as a developer I should say that I have been > completely blind, relying upon a screen review application known as JAWS and > a Braille display. > > I’m looking forward to being part of this list. Welcome! One thing I

Re: [GENERAL] Success stories of PostgreSQL implementations in different companies

2013-05-24 Thread Chris Angelico
On Sat, May 25, 2013 at 12:56 AM, Scott Marlowe wrote: > In addition to the other places mentioned, don't forget that the .info > and .org TLDs run on pgsql. and run quite well too. Oracle tossed a > LOT of FUD when Afilias put in their bid to run the TLD on postgresql. > It was actually quite pat

Re: [GENERAL] Success stories of PostgreSQL implementations in different companies

2013-05-24 Thread Chris Angelico
On Fri, May 24, 2013 at 11:52 PM, wrote: > Thank you all of you for your answers! It helps me a lot because when I'm > trying to convince a client to migrate to PostgreSQL sometimes they think > that because it's free, it only works for small databases for web or desktop > applications with a

Re: [GENERAL] Storing Special Characters

2013-05-14 Thread Chris Angelico
On Wed, May 15, 2013 at 8:20 AM, CR Lender wrote: > On 2013-05-14 19:32, Paul Jungwirth wrote: >> The UTF-8 encoding for a pound sign is 0xc2a3, not just 0xa3. You >> might want to make sure your PHP file is correct. > > Just for the record, the Unicode code point for the pound symbol (£) is > act

Re: [GENERAL] FATAL: database "a/system_data" does not exist

2013-05-10 Thread Chris Angelico
On Fri, May 10, 2013 at 5:13 PM, sumita wrote: > This error is getting logged at an interval of 2 minutes and 10 seconds > 2013-05-10 00:22:50 GMT:[4180]FATAL: database "a/system_data" does not > exist > 2013-05-10 00:25:00 GMT:[4657]FATAL: database "a/system_data" does not > exist > 2013-05-

Re: [GENERAL] What's wrong with postgresql.org domain?

2013-04-18 Thread Chris Angelico
On Thu, Apr 18, 2013 at 8:32 PM, Eduardo Morrás wrote: > On Thu, 18 Apr 2013 18:40:40 +1000 > Chris Angelico wrote: > >> Works for me. Do a name lookup - what IP address do you get? I get: >> >> postgresql.org. 17973 IN A 217.196.149.50 >&g

Re: [GENERAL] What's wrong with postgresql.org domain?

2013-04-18 Thread Chris Angelico
On Thu, Apr 18, 2013 at 6:33 PM, Magnus Hagander wrote: > On Thu, Apr 18, 2013 at 10:31 AM, Eduardo Morras wrote: >> >> >> I get Godaddy's page saying it's free > > Really? > > Whois shows it expires Oct 21 - and surely it will be renewed by then. > and godaddy says it's registered (though no det

Re: [GENERAL] procedure to contribute this community

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 8:27 AM, Gavin Flower wrote: > On 08/04/13 09:45, Chris Angelico wrote: >> My development >> platform consists of Linux, Xfce, five workspaces... > > On my workstation, I use xfce with 25 virtual workspaces, 8 currently empty, > I've been logged

Re: [GENERAL] procedure to contribute this community

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 4:14 AM, Gavin Flower wrote: > Not to mention that it appears that Postgres runs better on Linux than on > Microsoft. Linux skills are increasingly in demand, while MIcrosoft's > market share is dropping (partly as a result of the Metro fiasco!). > Are you allowed to call

Re: [GENERAL] Money casting too liberal?

2013-03-28 Thread Chris Angelico
On Fri, Mar 29, 2013 at 10:39 AM, Jasen Betts wrote: > how confusing is 'EST' ? > worse than this: > > set datestyle to 'sql,dmy'; > set time zone 'Australia/Brisbane'; > select '20130101T00Z'::timestamptz; > set time zone 'Australia/Sydney'; > select '20130101T00Z'::timestamptz; > set tim

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-23 Thread Chris Angelico
On Sat, Mar 23, 2013 at 1:50 AM, Bertrand Janin wrote: > Tom is right, this would be an optimization for a corner case, I noticed this > when running a generated script for a batch update that wasn't given a ton of > attention. The BEFORE UPDATE trigger will work great. If you know the app, just

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

2013-03-21 Thread Chris Angelico
On Thu, Mar 21, 2013 at 11:33 PM, Kalai R wrote: > Hi, > >I am using postgresql 9.0.3. In my application I change often schema > name using set search path. Some times schema name set correctly. But some > time it does not set correctly and it takes the schema previously I set. Is > any pos

Re: [GENERAL] Finding matching words in a word game

2013-03-06 Thread Chris Angelico
ding ~100K words took about 1 second, and the lookup took effectively no time. I don't think there's any need for a heavy database engine here, unless you're working with millions and millions of words :) Chris Angelico -- 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] Connection limit exceeded for non-superusers when there are plenty of available slots

2013-02-28 Thread Chris Angelico
On Fri, Mar 1, 2013 at 7:38 AM, G B wrote: > SHOW superuser_reserved_connections; > > 480 > > SHOW max_connections; > 500 > > Is there something I'm missing here? Thanks for your help. This leaves just 20 connections for non-root users. Did you intend to set superuser_reserved_connections

Re: [GENERAL] Order of granting with many waiting on one lock

2013-02-10 Thread Chris Angelico
On Mon, Feb 11, 2013 at 6:12 PM, Pavan Deolasee wrote: > * Determine where to add myself in the wait queue. > * > * Normally I should go at the end of the queue. Ah! That's perfect. So they'll actually go into perfect strict round-robin, assuming that there are no other locks comin

[GENERAL] Order of granting with many waiting on one lock

2013-02-10 Thread Chris Angelico
play keepings-off against the other eighteen? Chris Angelico -- 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] DEFERRABLE NOT NULL constraint

2013-02-06 Thread Chris Angelico
On Wed, Feb 6, 2013 at 10:36 PM, Bèrto ëd Sèra wrote: > Hi > >> I still don't see how that's any better than a stored procedure that >> directly does the INSERT. You can conceal the code every bit as >> easily. > > Guys I DO NOT write the customers' security guidelines. I get asked to > produce a

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-06 Thread Chris Angelico
On Wed, Feb 6, 2013 at 8:01 PM, Jasen Betts wrote: > On 2013-02-06, Bèrto ëd Sèra wrote: >> Hi >> >>> You've hidden nothing from INSERT-RETURNING. >> >> ?? Or from a select, if the final value is what you mean. What we hide >> is the way values are made, clearly not the final value. That bit is >

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Chris Angelico
On Wed, Feb 6, 2013 at 12:20 AM, 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 rule

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-05 Thread Chris Angelico
On Tue, Feb 5, 2013 at 11:32 PM, Alban Hertroys wrote: > 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 w

Re: [GENERAL] inet/cidr ipv6 operations

2013-01-29 Thread Chris Angelico
On Wed, Jan 30, 2013 at 2:16 AM, Tom Lane wrote: > Chris Angelico writes: >> Or alternatively, does PostgreSQL have any integer type larger than >> 64-bit bigint? I've become accustomed to using bignums in most of my >> programming; arbitrary-precision integer

Re: [GENERAL] inet/cidr ipv6 operations

2013-01-29 Thread Chris Angelico
On Tue, Jan 29, 2013 at 9:34 PM, George Shuklin wrote: > But IPv6 is differ. Let's assume we wants to get 'next' /64 range. Current > range is inet'2a00:ab00:0:1/64'. We want next. > > Postgres do not allow adding inet + inet, so we need to add natural number. > But 'next' /64 is 'just' 2^64. And

Re: [GENERAL] noobie question

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 4:45 AM, Steve Clark wrote: > Thanks All, > > This is for a few very small tables, less 100 records each, that a user can > delete and insert records into based on the "id" > which is displayed in a php generated html screen. The tables are rarely > updated and when they ar

Re: [GENERAL] noobie question

2013-01-24 Thread Chris Angelico
On Fri, Jan 25, 2013 at 3:47 AM, Steve Clark wrote: > Say I have a table that has 2 columns like > create table "foo" ( > id integer not null, > name text > ); > CREATE UNIQUE INDEX "foo_pkey" on "foo" using btree ( "id" "int4_ops" ); > > with 10 rows of data where id is 1 to 10. > > Now I wan

Re: [GENERAL] plpython intermittent ImportErrors

2013-01-15 Thread Chris Angelico
On Tue, Jan 15, 2013 at 4:55 AM, Brian Sutherland wrote: > I'm guessing that it's some kind of race condition, but I wouldn't know > where to start looking. Look for a recursive import (A imports B, B imports A) or multiple threads trying to import simultaneously - Python sometimes has issues wit

Re: [GENERAL] INSERT... WHERE

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 5:26 AM, Robert James wrote: > On 1/13/13, Chris Angelico wrote: >> On Mon, Jan 14, 2013 at 3:37 PM, Robert James >> wrote: >>> Thanks. But how do I do that where I have many literals? Something like: >>> >>> INSERT INTO seltes

Re: [GENERAL] Linux Distribution Preferences?

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 2:46 PM, Scott Marlowe wrote: > Most importantly, if you've got LOTS of talent for one distro or > another, you're probably best off exploiting it. If 95% of all the > developers and ops crew run Ubuntu or Debian, stick to one of them. > If they favor Fedora / RHEL stick t

Re: [GENERAL] INSERT... WHERE

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 3:37 PM, Robert James wrote: > Thanks. But how do I do that where I have many literals? Something like: > > INSERT INTO seltest (id, a, b) SELECT (1,2,3),(4,5,6),(7,8,9) WHERE b > IN (SELECT ...) You can use WITH clauses in crazy ways with PostgreSQL. I haven't actually t

Re: [GENERAL] Linux Distribution Preferences?

2013-01-13 Thread Chris Angelico
On Mon, Jan 14, 2013 at 11:07 AM, Chris Ernst wrote: > I've seen the opinion of "avoid Ubuntu like the plague" expressed many > times, but it is never followed up with any solid reasoning. Can you (or > anyone else) give specific details on exactly why you believe Ubuntu should > be avoided? I s

Re: [GENERAL] recasting to timestamp from varchar

2013-01-04 Thread Chris Angelico
On Sat, Jan 5, 2013 at 4:28 AM, Kirk Wythers wrote: > > I am trying to re-cast a column as a timestamp> > > ALTER TABLE sixty_min ALTER COLUMN time2 TYPE timestamp; > ERROR: column "time2" cannot be cast to type timestamp without time zone > > The column time2 is currently a varchar. I actually d

Re: [GENERAL] Coalesce bug ?

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 9:31 AM, Adrian Klaver wrote: > On 12/21/2012 02:22 PM, Chris Angelico wrote: >> As I understand it, there are three keywords: VOLATILE, STRICT, and >> IMMUTABLE. Putting one of those keywords into the declaration flags >> the function accordin

Re: [GENERAL] Coalesce bug ?

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 3:53 AM, David Johnston wrote: > Chris Angelico wrote, and David dropped the citation (oops!): >> By the way, why do you declare your functions as "STRICT IMMUTABLE" >> and "STRICT VOLATILE"? > > Is this a question about th

Re: [GENERAL] Coalesce bug ?

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:57 AM, jg wrote: > Hi, > > Interesting idea. > With VOLATILE, the bug disappears. > With IMMUTABLE, the EXPLAIN and the execution does not match > That is a bug. Even if the behavior has to be different in VOLATILE and > IMMUTABLE, the EXPLAIN and the execution MUST

Re: [GENERAL] Coalesce bug ?

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:40 AM, jg wrote: > Thank you for the documentation link, but it does not help me. The documentation link states that a function with side effects *must* to be declared VOLATILE (or if you prefer, *not* declared STRICT or IMMUTABLE). Emitting warnings is a side effect; yo

Re: [GENERAL] Coalesce bug ?

2012-12-21 Thread Chris Angelico
On Sat, Dec 22, 2012 at 2:25 AM, David Johnston wrote: > You have defined the function as "IMMUTABLE". The system is allowed to cache > the results of a given call (i.e. "ps3(2)") and return the value without > actually executing the function ("never executed"). Your second example > returns

Re: [GENERAL] problem with large inserts

2012-12-17 Thread Chris Angelico
On Tue, Dec 18, 2012 at 12:22 AM, Kevin Grittner wrote: > Lutz Fischer wrote: > >> I am running postgresql 9.2 on a windows 2008 R2 server with 256 GB and >> the database is on something like a raid 1+0 (actually a raid1e) >> consisting of 3x4TB disks (limit of what could easily be fitted into the

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Chris Angelico
On Fri, Dec 14, 2012 at 7:22 AM, John R Pierce wrote: > On 12/13/2012 5:32 AM, seil...@so-net.net.tw wrote: >> >> I am trying to implement a mechanism that prohibits the last row of a data >> set from being deleted. >> >> CREATE TABLE t1 (c1 INTEGER,c2 INTEGER, PRIMARY KEY (c1,c2)); >> >> INSERT I

Re: [GENERAL] Problem with aborting entire transactions on error

2012-12-11 Thread Chris Angelico
On Tue, Dec 11, 2012 at 10:36 PM, Zbigniew wrote: > There are always TWO sides (at least two): creators/designers - and > the users. Considering how much complexity some kind of modification > adds to your - programmer's - code, and how it'll make your life more > difficult, at the same time try t

Re: [GENERAL] large database

2012-12-11 Thread Chris Angelico
On Tue, Dec 11, 2012 at 9:33 PM, Gavin Flower wrote: > > On Tue, Dec 11, 2012 at 7:26 AM, Mihai Popa wrote: > > Second, where should I deploy it? The cloud or a dedicated box? > > Would you say the issue is cloudy? > (I'm not being entirely facetious!) *Groan* :) It's certainly not clear-cut in

Re: [GENERAL] large database

2012-12-11 Thread Chris Angelico
On Tue, Dec 11, 2012 at 7:26 AM, Mihai Popa wrote: > Second, where should I deploy it? The cloud or a dedicated box? Forget cloud. For similar money, you can get dedicated hosting with much more reliable performance. We've been looking at places to deploy a new service, and to that end, we booked

Re: [GENERAL] Problem with aborting entire transactions on error

2012-12-10 Thread Chris Angelico
Caveat: I am not a PostgreSQL hacker, and have not looked into its internals at all, though I've read a number of excellent articles and blog posts on some of its features (TOAST, HOT updates, MVCC, etc). I'm a programmer who has made use of PG from a number of languages, and formed a strong opinio

Re: [GENERAL] Problem with aborting entire transactions on error

2012-12-10 Thread Chris Angelico
On Tue, Dec 11, 2012 at 1:15 AM, David Johnston wrote: >> -Original Message- >> From: Zbigniew [mailto:zbigniew2...@gmail.com] >> Sent: Monday, December 10, 2012 6:26 AM >> To: David Johnston >> Subject: Re: [GENERAL] Problem with aborting entire transactions on error >> >> No idea, why co

Re: [GENERAL] libpq - prevent automatic reconnect

2012-12-06 Thread Chris Angelico
On Thu, Dec 6, 2012 at 5:56 AM, Tom Lane wrote: > I suspect this action isn't dropping the TCP connection. It's only > equivalent to a momentary glitch in your network connectivity --- and > you'd be very unhappy if that caused TCP connections to go down, because > networks have glitches all the

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

2012-12-04 Thread Chris Angelico
On Wed, Dec 5, 2012 at 2:12 PM, Gauthier, Dave 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"; > > ERR

Re: [GENERAL] Revoke "drop database" even for superusers?

2012-12-01 Thread Chris Angelico
On Sun, Dec 2, 2012 at 10:20 AM, Edson Richter wrote: > I've put both files in ~/deny_drop folder, and executed "make": > > # LANG=C make > Makefile:13: ../../src/Makefile.global: No such file or directory > Makefile:14: /contrib/contrib-global.mk: No such file or directory > make: *** No rule to

Re: [GENERAL] youtube video on pgsql integrity

2012-11-29 Thread Chris Angelico
On Fri, Nov 30, 2012 at 2:00 AM, Ray Stell wrote: > > On Nov 29, 2012, at 9:27 AM, Kevin Grittner wrote: >> is everything shown there really >> the behavior of the MySQL database itself? > > Good question. I intend to install mysql one day to explore, but just can't > find the time. The particu

Partial authentication (was Re: [GENERAL] sefety of passwords for web-service applications)

2012-11-24 Thread Chris Angelico
On Sat, Nov 24, 2012 at 8:41 PM, Chris Travers wrote: > 2) PostgreSQL allows you to move this authentication to a secondary service > like Kerberos, LDAP, or anything PAM supported. This means that if you want > to you can use a dedicated password store for the passwords which is not > accessibl

Re: [GENERAL] Maintaining state across function calls

2012-11-20 Thread Chris Angelico
On Tue, Nov 20, 2012 at 12:30 PM, Craig Ringer wrote: > C++ exception handling and the PostgreSQL backend's longjmp() based > error handling will interact in exciting and interesting ways. Define "interesting"? You mean in Wash's sense of "Oh God, oh God, we're going to receive signal 9"? Not a

Re: [GENERAL] PG_TERMINATE_BACKEND not working.

2012-11-18 Thread Chris Angelico
On Sun, Nov 18, 2012 at 10:25 PM, Craig Ringer wrote: > On 11/16/2012 02:34 PM, Harry wrote: >> I am facing problem i.e. connections after execution completed are residing >> in pg_stat_activity and pg_stat_database. >> but when i am trying to kill them manually using pg_terminate_backend (All >>

Re: [GENERAL] integer instead of 'double precision'?

2012-11-12 Thread Chris Angelico
On Tue, Nov 13, 2012 at 12:16 AM, Willy-Bas Loos wrote: > On Fri, Sep 9, 2011 at 5:09 PM, Guillaume Lelarge > wrote: >> >> You divide an integer with an integer, that should give you an integer. > > Can you tell me the reasoning behind that idea? > Is it a rule that the output type of an operator

Re: PG defaults and performance (was Re: [GENERAL] Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum))

2012-11-10 Thread Chris Angelico
On Sun, Nov 11, 2012 at 8:05 AM, Jeff Janes wrote: > Totally not. With default settings and default pgbench, the easiest > way for host B to beat host A is by lying about the durability of > fsync. True. Without the ability to brutally cut the power to a cloud instance or other remote (and in so

PG defaults and performance (was Re: [GENERAL] Unexpectedly high disk space usage RESOLVED (Manual reindex/vacuum))

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 12:26 PM, Steve Crawford wrote: > Don't do that. Defaults are good for ensuring that PostgreSQL will start on > the widest reasonable variety of systems. They are *terrible* for > performance and are certainly wrong for the system you describe. Tuning a PostgreSQL database

Re: [GENERAL] alter view foo set () -- fixed in 9.2 stable, but when will it be released?

2012-11-04 Thread Chris Angelico
On Mon, Nov 5, 2012 at 8:48 AM, Ondrej Ivanič wrote: > On 5 November 2012 08:39, Chris Angelico wrote: >> Point of random curiosity: The commit mentioned adds the following line: >> >> if (rinfo->reloptions && strlen(rinfo->reloptions) > 0) >> >&

Re: [GENERAL] alter view foo set () -- fixed in 9.2 stable, but when will it be released?

2012-11-04 Thread Chris Angelico
On Sat, Nov 3, 2012 at 9:15 AM, Joe Van Dyk wrote: > I'm running into this bug fixed a few days after 9.2.1 was released: > http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=d2292f6405670e1fdac13998f87b4348c71fb9e6 > > Anyone know when 9.2.2 will go out? Point of random curiosity:

Re: [GENERAL] How to find out if the server is postgres slave ??

2012-11-02 Thread Chris Angelico
On Fri, Nov 2, 2012 at 9:06 AM, expertalert wrote: > > From command line, is there any way to find out if the server is actually a > slave server not master ?? > > I am writing some script, so for sanity check purpose , i need to know if > the server the server i am on , its actually slave > > t

Re: [GENERAL] pgsql server reset the connection immediately after connected

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 2:43 PM, Dongkuo Ma wrote: > I connect to database and then fork a new process! > Now it's ok. > Thanks. Ah, yes, that would be a dangerous thing to do :) ChrisA -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] pgsql server reset the connection immediately after connected

2012-11-01 Thread Chris Angelico
x27;s strange because the server reset connection after connected,and > the connect function should throw a exception. > > It's nothing in the log file. Is there a long delay between connecting and executing a query? It may be that something disconnected you during that time. Or could the s

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 10:35 AM, Adrian Klaver wrote: > On 11/01/2012 03:03 PM, Chris Angelico wrote: >> >> My crystal ball tells me that you're SSHing to your remote server, >> running SSH in some kind of local terminal. It's the local terminal >> that will

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 8:56 AM, Kevin Burton wrote: > > That is the problem. There doesn't seem to be any copy on the Linux shell > that I am running (I think it is bash). My crystal ball tells me that you're SSHing to your remote server, running SSH in some kind of local terminal. It's the local

Re: [GENERAL] Where is 'createdb'?

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 2:37 AM, Magnus Hagander wrote: > > On Thu, Nov 1, 2012 at 4:32 PM, Kevin Burton > wrote: >> >> The text before this command says, “Once >> you have Postgres installed, create a schema called book using the following >> command: $ createdb book’ > > The authors are incorrec

Re: [GENERAL] Unable to do a mailing list proper search

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 1:02 AM, wrote: >> >> On 10/31/2012 12:59 PM, cr...@gtek.biz wrote: >>> list all role privileges >> >> Google: >> >> site:archives.postgresql.org 'list all role privileges' >> >> -- > > I was kind of hoping "The world's most advanced open source database." would > offer th

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 1:18 AM, Kevin Burton wrote: > I am not working on the same machine that I read email from. The machine > that has the Linux Server on it has no GUI installed. In that case, two options: 1) Copy and paste from your SSH session locally 2) Transfer the file processes.txt to

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 1:06 AM, Kevin Burton wrote: > If I use vi as my editor how do I copy the text to the clipboard? I would recommend picking an editor that matches the way you post to the list. For example, I use webmail with a GUI web browser, so the editor that I'd use to copy to the clipb

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 12:56 AM, Chris Angelico wrote: > On Fri, Nov 2, 2012 at 12:51 AM, Kevin Burton > wrote: >> If you change the grep to postgres then there are a number of entries (about >> 17). The output since I don't have a clipboard is too much to try and type

Re: [GENERAL] role does not exist

2012-11-01 Thread Chris Angelico
On Fri, Nov 2, 2012 at 12:51 AM, Kevin Burton wrote: > If you change the grep to postgres then there are a number of entries (about > 17). The output since I don't have a clipboard is too much to try and type > in by hand. Try this: ps ax| grep postgresql >processes.txt Then open processes.txt

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 12:53 AM, Adrian Klaver wrote: > On 10/29/2012 04:00 AM, Chris Angelico wrote: >> >> Not sure what you mean by that, but my postgresql.conf doesn't have >> anything about application_name. But if it did, it would be a default >>

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-29 Thread Chris Angelico
On Mon, Oct 29, 2012 at 5:44 PM, Tianyin Xu wrote: > Got it! Thanks, Chris! > > I still wonder why application_name appears in the configuration file if it > cannot take effort :-P Not sure what you mean by that, but my postgresql.conf doesn't have anything about application_name. But if it did,

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-28 Thread Chris Angelico
On Mon, Oct 29, 2012 at 5:22 PM, Tianyin Xu wrote: > Thanks a lot, Chris! > > Yes, the manual said that "It is typically set by an application upon > connection to the server." exactly your approach. > > But the examples you gave me is to print the application_name in the query > results, aren't t

Re: [GENERAL] How to print application_name in log_line_prefix (using %a)?

2012-10-28 Thread Chris Angelico
On Mon, Oct 29, 2012 at 4:18 PM, Tianyin Xu wrote: > However, I have the following configuration settings in postgresql.conf > > application_name = 'mypostgres' > log_line_prefix = '[%a] ' > I'm not familiar with this usage of setting application_name in postgresql.conf - usually I set it as part

Re: [GENERAL] Plug-pull testing worked, diskchecker.pl failed

2012-10-26 Thread Chris Angelico
On Sat, Oct 27, 2012 at 4:26 PM, Greg Smith wrote: > In general, through, diskchecker.pl is the more sensitive test. If it > fails, storage is unreliable for PostgreSQL, period. It's good that you've > followed up by confirming the real database corruption implied by that is > also visible. In

Re: [GENERAL] Need sql to pull data from terribly architected table

2012-10-24 Thread Chris Angelico
On Thu, Oct 25, 2012 at 2:42 AM, Steve Litt wrote: > Also, with the organization they're using, one can make new "columns" > on the fly. ... Anyway, the keypuncher is punching > data, comes across a brand new type of data (let's say "artist"), so > for this row the keypuncher puts in a key-value p

Re: [GENERAL] Plug-pull testing worked, diskchecker.pl failed

2012-10-24 Thread Chris Angelico
On Tue, Oct 23, 2012 at 9:51 AM, Scott Marlowe wrote: > On Mon, Oct 22, 2012 at 7:17 AM, Chris Angelico wrote: >> After reading the comments last week about SSDs, I did some testing of >> the ones we have at work - each of my test-boxes (three with SSDs, one >> with HDD)

Re: [GENERAL] Plug-pull testing worked, diskchecker.pl failed

2012-10-22 Thread Chris Angelico
On Tue, Oct 23, 2012 at 6:26 AM, Jeff Janes wrote: > What did you do to look for corruption? That PosgreSQL succeeds at > going through crash-recovery and then starting up is not a good > indicator that there is no corruption. I fired up Postgres and looked at the logs for any signs of failure.

Re: [GENERAL] Postgres Login Users Details

2012-10-22 Thread Chris Angelico
On Mon, Oct 22, 2012 at 7:47 PM, Vishalakshi Navaneethakrishnan wrote: > Hi all, > > I need to know who are all access database from different remote host. > > Example : > > User1@host1 logged / access db dbuser@dbname in Dbserver > > How can i get this information? As suggested, you can configu

[GENERAL] Plug-pull testing worked, diskchecker.pl failed

2012-10-22 Thread Chris Angelico
After reading the comments last week about SSDs, I did some testing of the ones we have at work - each of my test-boxes (three with SSDs, one with HDD) subjected to multiple stand-alone plug-pull tests, using pgbench to provide load. So far, there've been no instances of PostgreSQL data corruption,

Re: [GENERAL] obtain the difference between successive rows

2012-10-20 Thread Chris Angelico
On Sun, Oct 21, 2012 at 3:29 AM, Raymond O'Donnell wrote: > On 20/10/2012 17:23, Tom Lane wrote: >> Having said that, they are pretty expensive. I tend to agree that doing >> the processing on the application side might be faster --- but only if >> you've got a place to put such code there. If y

Re: [GENERAL] obtain the difference between successive rows

2012-10-20 Thread Chris Angelico
On Sun, Oct 21, 2012 at 2:30 AM, Berend Tober wrote: > What about if there is more than one column you want the difference for (... > coincidentally I am writing a article on this topic right now! ...), say a > table which is used to record a metered quantity at not-quite regular > intervals: > ..

Re: [GENERAL] 9.1/9.2 SERIALIZABLE: expected serialization failure between INSERT and SELECT not encountered

2012-10-18 Thread Chris Angelico
On Fri, Oct 19, 2012 at 1:22 AM, Kevin Grittner wrote: > Now, if no records are inserted or deleted by another connection, how > many rows will be deleted by this statement?: > > delete from rc where id = (select min(id) from rc); > > It's a trick question; the answer depends on a race condition.

Re: [GENERAL] 9.1/9.2 SERIALIZABLE: expected serialization failure between INSERT and SELECT not encountered

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 11:26 PM, Kevin Grittner wrote: > updating a "last_used" number in a table and > using the result (if it is *is* critical that there are no gaps in > the numbers). Correct me if I'm wrong, but wouldn't: update some_table set last_used=last_used+1 returning last_used simp

Re: [GENERAL] 9.1/9.2 SERIALIZABLE: expected serialization failure between INSERT and SELECT not encountered

2012-10-18 Thread Chris Angelico
On Thu, Oct 18, 2012 at 3:08 PM, Craig Ringer wrote: > BTW, the issue with the underlying question is that their "name" column is > unique. They expected to get a serialization failure on duplicate insert > into "name", not a unique constraint violation. The question wasn't "why > doesn't this fai

Re: [GENERAL] Improve MMO Game Performance

2012-10-17 Thread Chris Angelico
On Mon, Oct 15, 2012 at 7:16 PM, Albe Laurenz wrote: > - Set fsync=off and hope you don't crash. Ouch. I might consider that for a bulk import operation or something, but not for live usage. There's plenty else can be done without risking data corruption. ChrisA -- Sent via pgsql-general mail

Re: [GENERAL] problem with distinct not distincting...

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 2:32 AM, John Beynon wrote: > I just managed to solve the problem infact. > > The trailing 'e' character on the name was different for one row. All > my tools, (pgadmin and the source data in openoffice) showed the same > 'e' character but psql showed it as different charac

Re: [GENERAL] PostgreSQL training recommendations?

2012-10-17 Thread Chris Angelico
On Thu, Oct 18, 2012 at 12:56 AM, Vincent Veyron wrote: > > I am surprised none of the fine contributors to this thread mentionned > an activity they practice extensively, which is reading this list's > content every day. > > Best training material ever in my opinion. A pay-for magazine you can p

Re: [GENERAL] database corruption questions

2012-10-13 Thread Chris Angelico
On Sun, Oct 14, 2012 at 1:13 PM, Craig Ringer wrote: > * Never, ever, ever use cheap SSDs. Use good quality hard drives or (after > proper testing) high end SSDs. Read the SSD reviews periodically posted on > this mailing list if considering using SSDs. Make sure the SSD has a > supercapacitor or

Re: [GENERAL] Trajectory of a [Pg] DBA

2012-10-04 Thread Chris Angelico
On Fri, Oct 5, 2012 at 6:44 AM, Thalis Kalfigkopoulos wrote: > Is it an easier and more common entry point to be a part-time DBA e.g. > perform DBA duties as part of being a U**X sysadmin? > > Is it more common to start as a developer and change focus to DBA? > > In particular how does one go abou

Re: [GENERAL] Thousands of schemas and ANALYZE goes out of memory

2012-10-02 Thread Chris Angelico
On Wed, Oct 3, 2012 at 10:09 AM, Jeff Janes wrote: > On Tue, Oct 2, 2012 at 10:38 AM, Hugo wrote: >>> That might be the problem. I think with 32 bits, you only 2GB of >>> address space available to any given process, and you just allowed >>> shared_buffers to grab all of it. >> >> The address s

Re: [GENERAL] Question about permissions on database.

2012-09-22 Thread Chris Angelico
On Sun, Sep 23, 2012 at 6:47 AM, Ryan Kelly wrote: > On Sat, Sep 22, 2012 at 11:35:00PM +0300, Condor wrote: >> Hello, >> I wanna ask: is there a short way to giver permission to one user to >> select/insert (all privileges) on whole database ? >> Im create a user and try to give him all permissio

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

2012-09-20 Thread Chris Angelico
On Fri, Sep 21, 2012 at 2:39 PM, John R Pierce wrote: > On 09/20/12 10:27 AM, Alan Millington wrote: >> >> I am using Notepad, which inserts the byte order mark. Following the links >> a bit further, I gather that the version of Notepad that I am using may not >> identify a UTF8 file correctly if

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

2012-09-20 Thread Chris Angelico
On Fri, Sep 21, 2012 at 11:21 AM, Craig Ringer wrote: > I strongly disagree. The BOM provides a useful and standard way to > differentiate UTF-8 encoded text files from the random pile of encodings > that any given file could be. The only reliable way to ascertain the encoding of a hunk of data i

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-19 Thread Chris Angelico
On Wed, Sep 19, 2012 at 11:15 PM, David Johnston wrote: > I could maybe see something like the following having some value: > > SELECT inverse > FROM data > WHERE x<>0 AND inverse > .5 > MACRO inverse (1/x) > WITH macros AS (SELECT *,1/x AS inverse FROM data) SELECT inverse FROM macros WHERE x<>0

Re: [GENERAL] Double types

2012-09-18 Thread Chris Angelico
On Wed, Sep 19, 2012 at 7:25 AM, Hall, Samuel L (Sam) wrote: > > I have an application that writes an Excel Spreadsheet to postgres. For the > values that go in number fields, I check the Excel values for dbnull and set > the parameters to 0, like this: cmd.Parameters(9).Value = 0. Npgsql throws

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-18 Thread Chris Angelico
On Tue, Sep 18, 2012 at 4:44 PM, Craig Ringer wrote: > On 09/18/2012 07:32 AM, Tom Lane wrote: >> >> It's easier to understand why this is if you realize that SQL has a very >> clear model of a "pipeline" of query execution. > > I just wish they hadn't written it backwards! > > It'd be much less c

Re: [GENERAL] Official C++ API for postgresql?

2012-09-17 Thread Chris Angelico
On Tue, Sep 18, 2012 at 5:56 AM, Adrian Klaver wrote: > I think the confusing part is: > > > "This library works on top of the C-level API library, libpq. It comes with > postgres" > > The it refers to libpq not libpqxx. Sounds to me like a wording change might be in order - perhaps "... libpq, w

  1   2   3   >