Re: [GENERAL] authentication/privileges

2013-05-10 Thread Jasen Betts
On 2013-05-10, Alvaro Herrera wrote: > Tom Lane escribió: > >> It's fairly common for distro-supplied packages to create a postgres >> OS user but not assign it any password. In that state, the only way to >> become postgres is to "su" to it from root, or perhaps from a sudoer >> account with roo

Re: [GENERAL] Shortcut evaluation in OR or IN

2013-05-06 Thread Jasen Betts
On 2013-05-06, Tim Uckun wrote: > --047d7b2e4ea07402b004dc034a3b > Content-Type: text/plain; charset=UTF-8 > > Say I have a select like this. > > SELECT * FROM table where field = X OR field = Y limit 1 > > And I have two records one that matches X and one that matches Y will I > always get X beca

Re: [GENERAL] Associative array in Pl/PgSQL

2013-05-04 Thread Jasen Betts
On 2013-05-04, Karel Riveron Escobar wrote: > --=_be60f7f0-365e-4e0a-98b5-f8b13a8ea728 > Content-Type: text/plain; charset=utf-8 > Content-Transfer-Encoding: quoted-printable > > Hello everyone, > > > I have a problem with Pl/PgSQL function. I need to pass it as parameter an = > associative array

Re: [GENERAL] Simple SQL INSERT to avoid duplication failed: why?

2013-05-04 Thread Jasen Betts
On 2013-05-01, Carlo Stonebanks wrote: > There are no client poolers (unless pgtcl has one I don't know about) so > this is unlikely. > > The trigger is an interesting idea to try if it happens again - I can't keep > it for long as it is for a massive cache (used to deflect calls to a web > servi

Re: [GENERAL] pgAdmin shows two servers with the identical data

2013-04-27 Thread Jasen Betts
On 2013-04-28, Bob Futrelle wrote: > --001a11c2f448244d3504db64b5d7 > Content-Type: text/plain; charset=ISO-8859-1 > > I have two PG servers with the same data. > > I know the data is the same, because if I change a value in a table > > on one server, it changes the value in a table with the same

Re: [GENERAL] Table containing only valid table names

2013-04-27 Thread Jasen Betts
On 2013-04-26, Michael Graham wrote: > Hi all, > > I'm trying to create a table that contains only valid table names. could you get by with a view off pg_catalog.pg_tables or information_schema.tables -- ⚂⚃ 100% natural -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] regex help wanted

2013-04-27 Thread Jasen Betts
On 2013-04-25, Karsten Hilbert wrote: > On Thu, Apr 25, 2013 at 10:32:26AM -0400, Tom Lane wrote: > >> Karsten Hilbert writes: >> > What I don't understand is: Why does the following return a >> > substring ? >> >> >select substring ('junk $$ junk' from >> > '\$<[^<]+?::[^:]+?>\$'); >> >>

Re: [GENERAL] Optimizing bulk update performance

2013-04-27 Thread Jasen Betts
On 2013-04-27, Yang Zhang wrote: > On Sat, Apr 27, 2013 at 1:55 AM, Misa Simic wrote: >> Optionaly you can run vacuum analyze after bulk operation... > > But wouldn't a bulk UPDATE touch many existing pages (say, 20% > scattered around) to mark rows as dead (per MVCC)? I guess it comes > down t

Re: [GENERAL] Set Returning Functions and array_agg()

2013-04-25 Thread Jasen Betts
On 2013-04-24, Stephen Scheck wrote: > --f46d043c810aa794a404db21f464 > Content-Type: text/plain; charset=ISO-8859-1 > > Possibly due to my lack of thorough SQL understanding. Perhaps there's a > better way of doing what I'm ultimately trying to accomplish, but still the > question remains - why d

Re: [GENERAL] run COPY as user other than postgres

2013-04-24 Thread Jasen Betts
On 2013-04-23, Kirk Wythers wrote: > I would like to run the COPY command as a user other than "postgres". I find > it a bit of a pain (or at least requiring an extra step or two) to have the > postgres user own the files that I am creating with COPY TO. Here is a simple > example where the loc

Re: [GENERAL] PostgreSQL registry entries for apt-get/yum/rpm install

2013-04-20 Thread Jasen Betts
On 2013-04-15, dinesh kumar wrote: > --047d7b675e70cee73c04da61865c > Content-Type: text/plain; charset=ISO-8859-1 > > Dear Sirs, > > Apologizes, if this is a duplicate question. > > Would like to request you to share your valuable inputs on this. I would > like to know the PostgreSQL registry ent

Re: [GENERAL] how to get collation according to Unicode Collation Algorithm?

2013-04-06 Thread Jasen Betts
On 2013-04-06, rudolf wrote: > Hi, > > I have a problem with proper collation of UTF-8 strings using PostgreSQL > version 9.2.4 under Debian Linux 6.0 with de_DE.utf8 (but en_US behaves > the same) locale: > > CREATE TABLE test_collation ( q text ); > INSERT INTO test_collation (q) VALUES ('aa')

Re: [GENERAL] Need advice to avoid ORDER BY

2013-04-06 Thread Jasen Betts
On 2013-04-04, Condor wrote: > Hello, > > I have one query in my postgresql 9.2.3 that took 137 ms to me executed > and looking a way > what I can do to optimize it. I have one table generated numbers from 1 > to 1 000 000 and > I need to get first free id, meanwhile id's when is taken can be fr

Re: [GENERAL] bug in COPY implementation (all versions of Postgres)?

2013-04-06 Thread Jasen Betts
On 2013-04-05, Konstantin Izmailov wrote: > > 2. Insert value 'Galaxy\040Tab' using command COPY TEST(description) FROM > stdin WITH DELIMITER '|' CSV. > > The following error is returned: value too long for type character > varying(10) CSV is essentially a binary format. there is no ecaping in C

Re: [GENERAL] Using varchar primary keys.

2013-04-06 Thread Jasen Betts
On 2013-04-02, Joe Van Dyk wrote: > On Tue, Apr 2, 2013 at 11:16 AM, Merlin Moncure wrote: >> On Tue, Apr 2, 2013 at 10:34 AM, Joe Van Dyk wrote: >> > >> > I've been wishing for a smaller uuid type for a while. >> > I've been using a unique text column with a default of >> > random_characters(12

Re: [GENERAL] Using varchar primary keys.

2013-03-31 Thread Jasen Betts
On Mon, Apr 01, 2013 at 07:08:15PM +1300, Tim Uckun wrote: > > > > how about using an enum instead of this table? > > > > > That's an interesting idea. Are enums mutable? since 9.1 you can add values. http://www.postgresql.org/docs/9.1/static/sql-altertype.html -- ⚂⚃ 100% natural -- Sent

Re: [GENERAL] Using varchar primary keys.

2013-03-31 Thread Jasen Betts
On 2013-04-01, Tim Uckun wrote: > --14dae93996072d9ff304d945bd3c > Content-Type: text/plain; charset=UTF-8 > >> >> >> Natural Keys have a purpose but when do they exist in the database? >> >> > In my case it's the tags. Table tags has only two columns id and tag. Each > one has a unique index. I

Re: [GENERAL] Money casting too liberal?

2013-03-30 Thread Jasen Betts
On 2013-03-29, Gavan Schneider wrote: > Some thoughts. > > The current MONEY type might be considered akin to ASCII. > Perfect for a base US centric accounting system where there are > cents and dollars and no need to carry smaller fractions. As > discussed, there are some details that could be

Re: [GENERAL] Money casting too liberal?

2013-03-28 Thread Jasen Betts
On 2013-03-28, Gavin Flower wrote: > > Hmm... This should optionally apply to time. e.g. > time_i_got_up_in_the_morning should reflect the time zone where I got up > - if I got up at 8am NZ time then this should be displayed, not 12pm (12 > noon) to someone in Los Angeles or 3am in Tokyo! (hav

Re: [GENERAL] Is there any way to listen to NOTIFY in php without polling?

2013-03-28 Thread Jasen Betts
On 2013-03-27, Misa Simic wrote: > --20cf3074d6a0c370ce04d8ef50c1 > Content-Type: text/plain; charset=UTF-8 > > Hi Clemens, > > Well, I am not sure what you mean by polling... > > But Example shows - that C app - actually asks all the time to get > notify... when gets something more then 4 times -

Re: [GENERAL] Understanding behavior of SELECT with multiple unnested columns

2013-03-28 Thread Jasen Betts
On 2013-03-27, Ken Tanzer wrote: > --047d7b5da657ecd54004d8e23a90 > Content-Type: text/plain; charset=ISO-8859-1 > > I've been working on some queries involving multiple unnested columns. At > first, I expected the number of rows returned would be the product of the > array lengths, so that this

Re: [GENERAL] Unexpected behaviour of encode()

2013-03-28 Thread Jasen Betts
On 2013-03-26, Tom Lane wrote: > The manual says that 'escape' encoding "merely outputs null bytes as > \000 and doubles backslashes". > (Having said that, I wonder though if "escape" doesn't need more > thought. The output is only valid text in SQL_ASCII or single-byte > encodings, otherwise

Re: [GENERAL] Money casting too liberal?

2013-03-28 Thread Jasen Betts
On 2013-03-28, D'Arcy J.M. Cain wrote: > > I would like to see the type handle other situations such as foreign > (to me) currency, etc. I suppose a positional parameter and a currency > string setting would handle most of those issues. Technically, the > money type is a cents type. Everything

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-23 Thread Jasen Betts
On 2013-03-22, Ryan Kelly wrote: > On Fri, Mar 03/22/13, 2013 at 06:16:11AM -0700, Adrian Klaver wrote: >> On 03/22/2013 05:32 AM, Bertrand Janin wrote: >> >I noticed how rows were re-written to a different location (new ctid) even >> >without changes to the values. This illustrate what I mean: >>

Re: [GENERAL] File Fragmentation

2013-03-23 Thread Jasen Betts
On 2013-03-20, jg wrote: > Hi, > > I have a PostgreSQL database with 50 tables. > Every minute, sequentially, a batch load 10.000 rows of 250 bytes with a COPY. > > After a day, i got a database with 50 tables with 1.440 set of 10.000 rows. > The tables are cleany and naturally clustered by the in

Re: [GENERAL] Can't terminate hung COPY

2013-03-23 Thread Jasen Betts
On 2013-03-20, David Rees wrote: > On Wed, Mar 20, 2013 at 12:37 PM, David Rees wrote: >> PostgreSQL 8.4.16 on CentOS 5.9. >> >> I've run into a situation where executing a \COPY from psql will hang >> and at that point it's impossible to terminate the COPY command. > > Some additional notes: > >

Re: [GENERAL] Testing Technique when using a DB

2013-03-16 Thread Jasen Betts
On 2013-03-13, Joe Van Dyk wrote: > --047d7b6226a405604904d7d09001 > Content-Type: text/plain; charset=UTF-8 > > On Wed, Mar 13, 2013 at 8:47 AM, Steve Crawford < > scrawf...@pinpointresearch.com> wrote: > >> On 03/12/2013 09:05 PM, Perry Smith wrote: >> >>> To all who replied: >>> >>> Thank you.

Re: [GENERAL] DB design advice: lots of small tables?

2013-03-15 Thread Jasen Betts
On 2013-03-15, lender wrote: > Hello. > > We are currently redesigning a medium/large office management web > application. There are 75 tables in our existing PostgreSQL database, > but that number is artificially low, due to some unfortunate design choices. > > The main culprits are two tables na

Re: [GENERAL] C++Builder table exist

2013-03-15 Thread Jasen Betts
On 2013-03-13, Charl Roux wrote: > --_51d77859-0e03-4afa-bde6-853bee9c0a11_ > Content-Type: text/plain; charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable appologies for the formatting, gmane did something to your email that SLRN didn't like. > void __fastcall TfrmMain::FormCreat

Re: [GENERAL] Dumb question involving to_tsvector and a view

2013-02-23 Thread Jasen Betts
On 2013-02-23, Raymond C. Rodgers wrote: > On 02/23/2013 05:26 AM, Tom Lane wrote: >> A "virtual" tsvector like that is probably going to be useless for >> searching as soon as you get a meaningful amount of data, because the >> only way the DB can implement a search is to compute the tsvector

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-07 Thread Jasen Betts
On 2013-02-07, Albe Laurenz wrote: > Anyway, that's a sideline; at any rate the standard requires > deferrable NOT NULL constraints. Well, the standard syntax allows them to be requested, check constraints too. what does the standard say about it behaviourally? what do other major SQL databa

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-07 Thread Jasen Betts
here's a relatively clean way to do circular references: given the circular reference: table a ( i serial primary key , j integer references b(j) deferrable initially deferred ); table b ( j serial primary key , i integer references a(i) ); t

Re: [GENERAL] DEFERRABLE NOT NULL constraint

2013-02-06 Thread Jasen Betts
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 > accessible to anyone who can select the table, obviously. >

Re: [GENERAL] DEFERRABLE NOT NULL constraint

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

Re: [GENERAL] .pgpass and root: a problem

2013-02-05 Thread Jasen Betts
On 2013-02-05, Scott Mead wrote: > I would love to see pgpass storing encrypted stuff here, that'd be great... > in the meantime... whatever it stores will, of necessity, be sufficient to grant access to the postgres database, libpq could be modified to use MD5 hashed passwords in that file salt

Re: [GENERAL] Optimizing query?

2013-02-03 Thread Jasen Betts
On 2013-01-31, haman...@t-online.de wrote: > > Pavel Stehlule wrote: > >>> >> Hi, >>> >> >>> >> I am trying to match items from 2 tables based on a common string. >>> >> One is a big table which has one column with entries like XY123, ABC44, = >>> etc >>> >> The table has an index on that column.

Re: [GENERAL] Can LC_TIME affect timestamp input?

2013-02-03 Thread Jasen Betts
On 2013-01-28, Paul Jones wrote: > > Since posting this, I tried digging around in the source code.  From looking > at > "timestamp_in" and related routines, it doesn't appear to take into account > any LC_* environment var.  And I didn't see strftime(3) used for timestamps > (although I could h

Re: [GENERAL] finding if a period is multiples of a given interval

2013-02-03 Thread Jasen Betts
On 2013-01-28, c k wrote: > --bcaec5014c15b72ffb04d459337f > Content-Type: text/plain; charset=UTF-8 > > Hi, > I have two variables in pl/pgsql function. > p_fromdate and p_todate > > I have another variable which represents intervals like day, month, quarter > etc. > p_interval as smallint, to h

[GENERAL] Re: Is there a way to add a detail message in a warning with pl/Python?

2013-02-03 Thread Jasen Betts
On 2013-01-30, Adrian Klaver wrote: > On 01/30/2013 02:49 AM, DANIEL CRISTIAN CRUZ wrote: >> >> >> Em 29/01/2013 17:30, Adrian Klaver escreveu: >>> Why not: >>> >>> DO $$ >>> plpy.warning('test, detail') >>> $$ LANGUAGE plpythonu; >>> >>> In log: >>> >>> WARNING: test, detail >>> >> >> Becau

Re: [GENERAL] finding if a period is multiples of a given interval

2013-02-03 Thread Jasen Betts
On 2013-01-30, c k wrote: > --bcaec54eebba86ab5904d4815b33 > Content-Type: text/plain; charset=UTF-8 > > Thanks. > After some hacking it solved my problems using > select date_part('days', age('06/01/2010'::date ,'04/01/2010'::date)); > ??? you can't get there from here. -- ⚂⚃ 100% natural -

Re: [GENERAL] COPY table to file missing quotation marks

2013-02-03 Thread Jasen Betts
On 2013-01-31, Rich Shepard wrote: >I'd like to understand what I'm missing when I COPY a table to a .csv file > but the text is not quoted. > >Here's an example of a command: > > copy chemistry to '/home/postgres/emapchem.csv' with (format CSV, header > True, quote '"', delimiter '|'); >

Re: [GENERAL] Yet Another Timestamp Question: Time Defaults

2013-01-27 Thread Jasen Betts
On 2013-01-21, Steve Crawford wrote: > > Date/time is not trivial. The portions of the PostgreSQL manual dealing > with those data types bear careful and thoughtful reading and rereading > while you experiment at the same time in a psql terminal till it > "clicks." And while some time issues ar

Re: [GENERAL] Yet Another Timestamp Question: Time Defaults

2013-01-27 Thread Jasen Betts
On 2013-01-21, Gavan Schneider wrote: > On Monday, January 21, 2013 at 06:53, Adrian Klaver wrote: > > timezones I have been learning a lot from the side. > > Taking another tangent I would much prefer the default time to > be 12:00:00 for the conversion of a date to timestamp(+/-timezone).

Re: [GENERAL] Yet Another Timestamp Question: Time Defaults

2013-01-27 Thread Jasen Betts
On 2013-01-21, Rich Shepard wrote: >What is the behavior if a column data type is timestamptz but there is > only the date portion available? There must be a default time; can that be > defined? No, if you don't specify the time 00:00 (midnight) is used. if you don't specify a timezone it's l

Re: [GENERAL] Running update in chunks?

2013-01-27 Thread Jasen Betts
On 2013-01-25, Tim Uckun wrote: >> I agree that seems like the most likely cause. Each update to the >> row holding the hstore column requires adding new index entries for >> all the hstore elements, and autovacuum will need to clean up the >> old ones in the background. The best solution would be

Re: [GENERAL] Restore 1 Table from pg_dumpall?

2013-01-27 Thread Jasen Betts
On 2013-01-22, Rich Shepard wrote: >I neglected to dump a single table before adding additional rows to it via > psql. Naturally, I messed up the table. I have a full pg_dumpall of all > three databases and all their tables in a single .sql file from 2 days ago. > The file is 386M in size and

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-27 Thread Jasen Betts
On 2013-01-26, Gavan Schneider wrote: > On Saturday, January 26, 2013 at 08:13, Ian Pilcher wrote: > >>I need to cast a double precision into an integer, and I want to check >>that the value will actually fit (modulo rounding). >> >>Coming from a C/Java background, this seems like something that s

Re: [GENERAL] date_trunc to aggregate by timestamp?

2013-01-26 Thread Jasen Betts
On 2013-01-24, Kirk Wythers wrote: > I am trying to some up with an approach that uses "date_truc" to > aggregate 15 minute time series data to hourly bins. My current query > which utilizes a view, does performs a join after which I use a series a > WHERE statements to specify which of the 15

Re: [GENERAL] Can LC_TIME affect timestamp input?

2013-01-26 Thread Jasen Betts
On 2013-01-25, Paul Jones wrote: > Is it possible for LC_TIME locale to affect the format with which > timestamps are input? > I have DB2 CSV dumps with timestamps like '2003-10-21-22.59.44.00' All the non-digit symbols between "21" and the "44" look unusual > that I want to load into Postg

Re: [GENERAL] Cast double precision to integer & check for overflow

2013-01-26 Thread Jasen Betts
On 2013-01-26, Ian Pilcher wrote: > I need to cast a double precision into an integer, and I want to check > that the value will actually fit (modulo rounding). > > Coming from a C/Java background, this seems like something that should > be utterly trivial. In my searching, however, I can't seem

Re: [GENERAL] Update rule on a view - what am I doing wrong

2013-01-18 Thread Jasen Betts
On 2013-01-18, Leif Jensen wrote: >I have been fighting a problem with an update rule on a view. I > have a view that combines two tables where the 'sub' table (scont) can > have several rows per row in the 'top' table (icont). The view > combines these to show only one record per row in the

Re: [GENERAL] SELECT * and column ordering

2013-01-18 Thread Jasen Betts
On 2013-01-16, Meta Seller Dev/Admin wrote: > Hi! (I'm Chris Angelico posting from a work account - usually I'm here > under the name ros...@gmail.com.) > > I've run into a bit of an awkwardness in PostgreSQL setup and am > hoping for some expert advice. > > Several of the tables I work with have

Re: [GENERAL] Case insensitive collation

2013-01-18 Thread Jasen Betts
On 2013-01-16, Marcel van Pinxteren wrote: > --90e6ba6140da259e8204d36d0fa3 > Content-Type: text/plain; charset=ISO-8859-1 > > From the Microsoft site I learned > http://msdn.microsoft.com/en-us/library/ms188046(v=sql.105).aspx > that they combine collation and "ComparisonStyle" to a collation nam

Re: [GENERAL] Best method to compare subdomains

2013-01-18 Thread Jasen Betts
On 2013-01-16, Robert James wrote: > Is there a recommended, high performance method to check for subdomains? > > Something like: > - www.google.com is subdomain of google.com > - ilikegoogle.com is not subdomain of google.com > > There are many ways to do this (lowercase and reverse the string, >

Re: [GENERAL] How to store clickmap points?

2013-01-14 Thread Jasen Betts
On 2013-01-08, aasat wrote: > Hi, > > I want to store clickmap points (X, Y and hits value) for website > > I currently have table like this > > CREATE TABLE clickmap ( > page_id integer, > date date, > x smallint, > y smallint, > hits integer > ) > > But this generated about 1M rows pe

Re: [GENERAL] Any experience with Drobo SAN and PG?

2012-12-22 Thread Jasen Betts
On 2012-12-17, Michael Nolan wrote: > I'm looking to spec a new production server for a small client and > have been looking at the Drobo SAN units. > > Has anybody run PG on one of these yet? Drobo has, some of them run postgresql internally. -- ⚂⚃ 100% natural -- Sent via pgsql-general ma

Re: [GENERAL] Default timezone changes in 9.1

2012-12-22 Thread Jasen Betts
On 2012-12-16, Terence Ferraro wrote: > With the exception of a few parameters (max_connections and the ssl related > variables that we enable), the default configuration file (circa 9.0) has > worked extremely well across 100+ machines so far over the last two years > and counting. However, we a

Re: [GENERAL] Set returning functions in the SELECT list

2012-12-04 Thread Jasen Betts
On 2012-11-16, Tom Lane wrote: > Ryan Kelly writes: >> I have a question about the behavior of SRFs in the SELECT list. > > If you have more than one in a select list, the number of resulting rows > is the least common multiple of their periods, because the select list > gets cycled until they al

Re: [GENERAL] execute if statement

2012-12-03 Thread Jasen Betts
On 2012-12-01, Peter Kroon wrote: > --f46d043be1f4bd2dec04cfcfbd6a > Content-Type: text/plain; charset=ISO-8859-1 > > M... > > How do I execute dynamic sql that starts with an if statement. "if" is not SQL. > I'm converting mssql code to pgsql. probably best to rewrite at a higher level

Re: [GENERAL] alter sequence

2012-12-02 Thread Jasen Betts
On 2012-11-24, Peter Kroon wrote: > --f46d04389321c8f47d04cf3c0f32 > Content-Type: text/plain; charset=ISO-8859-1 > > ALTER SEQUENCE (select pg_get_serial_sequence('table', 'id')) RESTART WITH > 1; > The query fails: > ALTER SEQUENCE (select pg_get_serial_sequence('table... > it's because of the

Re: [GENERAL] obtain the difference between successive rows

2012-11-23 Thread Jasen Betts
On 2012-10-20, Berend Tober wrote: > Thalis Kalfigkopoulos wrote: >> On Sat, Oct 20, 2012 at 8:02 AM, Raymond O'Donnell wrote: >>> On 20/10/2012 11:54, ochaussavoine wrote: I have a table 'tmvt' with a field 'created' in the row, and would like to compute the difference between successi

Re: [GENERAL] obtain the difference between successive rows

2012-11-23 Thread Jasen Betts
On 2012-10-20, Tom Lane wrote: > "Raymond O'Donnell" writes: >> On 20/10/2012 17:23, Tom Lane wrote: >>> FWIW, Postgres is reasonably smart about the case of multiple window >>> functions with identical window definitions --- once you've got one >>> lag() in the query, adding more isn't going to

Re: [GENERAL] COPY FROM in psql

2012-11-23 Thread Jasen Betts
On 2012-11-21, Matthew Vernon wrote: > t...@sss.pgh.pa.us (Tom Lane) writes: > >> Matthew Vernon writes: >>> naiively, you might try: >>> \set pwd '\'' `pwd` '\'' >>> COPY table FROM :pwd || '/relative/path/to/data' ; >> >> Umm ... why don't you just use a relative path as-is, with \copy >> inste

Re: [GENERAL] PostgreSQL training recommendations?

2012-11-21 Thread Jasen Betts
On 2012-10-17, 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. Yeah, if you want to learn PostgreSQL this list

Re: [GENERAL] PostgresQL intallation error

2012-11-21 Thread Jasen Betts
On 2012-10-27, Raul Feliu wrote: > --_4c4db745-219d-4817-8789-6e7997227fee_ > Content-Type: text/plain; charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > > I have windows vista. I tried to run the installer in admin mode and I disa= > bled UAC. Still having the same problem.

Re: [GENERAL] Postgresql - 8.3 Replication in windows

2012-11-21 Thread Jasen Betts
On 2012-11-02, dinesh kumar wrote: > --20cf3071cc56678d5104cd82409f > Content-Type: text/plain; charset=ISO-8859-1 > > Hi , > > In windows we do not have SCP/RSYNC utility commands, which helps us to > send the archives to remote/slave server. pscp (putty.org) deltacopy -- ⚂⚃ 100% natural -

Re: [GENERAL] PG under OpenVZ?

2012-11-21 Thread Jasen Betts
On 2012-11-13, François Beausoleil wrote: > Hi! > > I've found an old thread on OpenVZ: > > (2008): http://archives.postgresql.org/pgsql-performance/2008-03/msg00076.php > > And a more recent question that scared me a bit: > > (2011): http://serverfault.com/questions/281783/running-mongodb-with-op

[GENERAL] Re: Aggeregate funtion calculating the average value of each same index of an array column in a table

2012-11-20 Thread Jasen Betts
On 2012-11-16, LEA KANG wrote: > Hi, > > I have a table with several lines as following; > > - Create table mytable (type number , values integer [2]) ; > > - Insert into mytable values (1, ‘{ 10, 0 }’ ); > - Insert into mytable values (1, ‘{ 20, 30 }’ ); > - Insert into mytab

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-17 Thread Jasen Betts
On 2012-11-06, Kevin Grittner wrote: > hari.fu...@gmail.com > >> No: the result of e.g. >> >>  SELECT TIMESTAMPTZ '2012-10-28 01:30:00' + INTERVAL '24 hours'; >> >> depends on the client's timezone and its DST rules. > > Can you give an example of where adding an interval based on *hours* > to T

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-17 Thread Jasen Betts
On 2012-11-06, Kevin Grittner wrote: > > For TIMESTAMP WITHOUT TIME ZONE it couldn't be IMMUTABLE, because the > result would be based on the time zone setting of the client > connection; but adding a fixed interval to a UTC time to get a UTC > time seems pretty immutable to me. That said, I'm not

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-17 Thread Jasen Betts
On 2012-11-06, Albe Laurenz wrote: > hari.fu...@gmail.com wrote: >> > I think the problem is that this + operator is implemented >> > by the function "timestamptz_pl_interval", which is STABLE >> > but not IMMUTABLE. >> > >> > I am not sure why this function cannot be IMMUTABLE, it >> > seems to m

Re: [GENERAL] Difference between varchar and text?

2012-11-17 Thread Jasen Betts
On 2012-11-05, Moshe Jacobson wrote: > --14dae93404f5f865d804cdc59353 > Content-Type: text/plain; charset=ISO-8859-1 > > Is there any practical difference between defining a column as a > varchar(n)vs. a varchar > vs. a text field? > > I've always been under the impression that if I am wanting to

Re: [GENERAL] Help estimating database and WAL size

2012-10-19 Thread Jasen Betts
On 2012-10-15, Daniel Serodio (lists) wrote: >> >> OID is optional, IIRC PGXID is not > I hadn't heard of PGXID, I've just searched Google but found no > reference to this term except for this e-mail thread and some source > code. What is PGXID? Where can I learn more about hit? That was the wr

Re: [GENERAL] Who is LISTENing?

2012-10-16 Thread Jasen Betts
On 2012-10-15, rektide wrote: > Hi pgsql-general, > > I'm interested in writing a supervisory process that can insure worker > processes are > running/spawn new ones if not. These workers will mainly be responsible for > LISTENing to > the db, which is emitting triggered_change_notification s. >

[GENERAL] Re: Suggestions for the best strategy to emulate returning multiple sets of results

2012-10-15 Thread Jasen Betts
On 2012-10-10, Seref Arikan wrote: > --f46d0443048225e0e704cbb5e0ee > Content-Type: text/plain; charset=ISO-8859-1 > > Thanks Bret, > I'm concerned about what happens when my functions under high load fills > the ramdrive with temporary tables I'm using. The advantage of telling > postgres to use

Re: [GENERAL] Postgres DB Migration from 8.3 to 9.1

2012-10-15 Thread Jasen Betts
On 2012-10-12, Vishalakshi Navaneethakrishnan wrote: > --e0cb4efe29e2435cf104cbd3459b > Content-Type: text/plain; charset=ISO-8859-1 > > Hi Friends, > > We have our production environment database server in Postgres 8.3 version. > we have planned to upgrade to lastest version 9.1. Dump from 8.3 a

Re: [GENERAL] Postgres DB Migration from 8.3 to 9.1

2012-10-15 Thread Jasen Betts
On 2012-10-12, Bruce Momjian wrote: > On Thu, Oct 11, 2012 at 07:38:07PM -0700, John R Pierce wrote: >> On 10/11/12 7:15 PM, Vishalakshi Navaneethakrishnan wrote: >> >We have our production environment database server in Postgres 8.3 >> >version. we have planned to upgrade to lastest version 9.1.

Re: [GENERAL] moving from MySQL to pgsql

2012-10-15 Thread Jasen Betts
On 2012-10-13, Merlin Moncure wrote: > On Sat, Oct 13, 2012 at 3:22 AM, Jasen Betts wrote: >> On 2012-10-11, Vineet Deodhar wrote: >> >>> To give an example, I have tables for storing master records (year master, >>> security master, etc.) for which pkid TINY

Re: [GENERAL] stored procedure multiple call call question

2012-10-13 Thread Jasen Betts
On 2012-10-02, Chris McDonald wrote: > Hi, > > > If I had a single table targ to insert into I would do an > > INSERT INTO targ SELECT thiscol, thatcol, theothercol FROM FOO. > > The problem is that I have tables targ1, targ2, targn to insert things into > and a nice stored procedure myproc whi

Re: [GENERAL] non-integer constant in ORDER BY: why exactly, and documentation?

2012-10-13 Thread Jasen Betts
On 2012-10-11, David Johnston wrote: > This is a multipart message in MIME format. > > --=_NextPart_000_0400_01CDA7D1.CAF1CC60 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@pos

Re: [GENERAL] moving from MySQL to pgsql

2012-10-13 Thread Jasen Betts
On 2012-10-11, Vineet Deodhar wrote: > To give an example, I have tables for storing master records (year master, > security master, etc.) for which pkid TINYINT is just sufficient. > These pkid's are used as fk constraints in tables for storing business > transactions. > The no. of rows in busin

Re: [GENERAL] moving from MySQL to pgsql

2012-10-13 Thread Jasen Betts
On 2012-10-10, Vineet Deodhar wrote: > --f46d040714c5d7a08c04cbb08256 > Content-Type: text/plain; charset=UTF-8 > > Hi ! > At present, I am using MySQL as backend for my work. > Because of the licensing implications, I am considering to shift from MySQL > to pgsql. > Typically, my apps are multi-u

Re: [GENERAL] Help estimating database and WAL size

2012-10-12 Thread Jasen Betts
On 2012-10-08, Daniel Serodio (lists) wrote: > We are preparing a PostgreSQL database for production usage and we need > to estimate the storage size for this database. We're a team of > developers with low expertise on database administration, so we are > doing research, reading manuals and us

Re: [GENERAL] Securing .pgpass File?

2012-10-02 Thread Jasen Betts
On 2012-10-01, Shaun Thomas wrote: > On 10/01/2012 12:19 PM, Darren Duncan wrote: > >> You should never put your passwords (or private keys) in source control; >> it would be better to use the puppet/bcfg option. > > That was kind of my point. Puppet / Bcfg2 have the same problem. About a > dozen

Re: [GENERAL] opened connection

2012-10-01 Thread Jasen Betts
On 2012-10-01, Levente Kovacs wrote: > On Sun, 30 Sep 2012 20:24:47 -0700 > Darren Duncan wrote: > > >> Unless you have very unique needs, keeping an open connection for >> days is just wrong anyway; if its for the sake of some user GUI or >> shell, there probably should be safeguards there to en

Re: [GENERAL] Running CREATE only on certain Postgres versions

2012-09-29 Thread Jasen Betts
On 2012-09-24, Robert James wrote: > I have some code which creates a function in Postgres, taken from > http://wiki.postgresql.org/wiki/Array_agg . > > DROP AGGREGATE IF EXISTS array_agg(anyelement); > CREATE AGGREGATE array_agg(anyelement) ( > SFUNC=array_append, > STYPE=anyarray, > INITCOND='{}

Re: [GENERAL] problem with recreating database with export

2012-09-29 Thread Jasen Betts
On 2012-09-27, Dennis Gearon wrote: > The errors were always 'illegal command', 10s of thousands of them. As far as > what I did 2 years ago, I can't remember 2 days ago, sorry about that ;-) Yes > it > is a plan text dump. I don't have huge databases yet, so to make it easier to > go > betw

[GENERAL] Re: Upgrade from 8.4.13 to 9.2.0.1 successful but it still displays 8.4.13 if SELECT version();

2012-09-24 Thread Jasen Betts
On 2012-09-23, a...@hsk.hk wrote: > Hi, > > I have upgraded postgresql 8.4.13 to 9.2.0.1 O/S Ubuntu, restarted > postgresql, > it displayed my postgresql is 9.2 but when I log into postgresql, show > version, > it is still 8.4.13, see a) and b) below, read the man pages for pg_upgradecluster

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

2012-09-23 Thread Jasen Betts
On 2012-09-21, Craig Ringer wrote: > I strongly disagree. The BOM provides a useful and standard way to > differentiate UTF-8 encoded text files what is stopping non utf8 files from starting with something that looks like a BOM? -- ⚂⚃ 100% natural -- Sent via pgsql-general mailing list

Re: [GENERAL] pg_dump slow on windows

2012-09-22 Thread Jasen Betts
On 2012-09-06, Kobus Wolvaardt wrote: > Something that is curios is that if a DB takes long, it really takes > horribly long like some kind of a lock is holding it. It would sit at a few > kb dump size for 20 minutes en then run a bit and get stuck again (as far > as we can tell), what we do know

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

2012-09-22 Thread Jasen Betts
On 2012-09-18, Rafal Pietrak wrote: > > Actual Tom's example(1): > SELECT 1/x AS inverse FROM data WHERE x <> 0; > extended to (2): > SELECT 1/x AS inverse FROM data WHERE x <> 0 AND 1/x > 20; > could be written by user as (3): > SELECT 1/x AS inverse FROM data WHERE x <> 0 AND i

Re: [GENERAL] On Ubuntu 12.04 i do have two psql one of those isn't working

2012-09-22 Thread Jasen Betts
On 2012-09-18, Raymond O'Donnell wrote: > On 18/09/2012 16:10, Yvon Thoraval wrote: >> I've found the prob. >> In my postgresql.conf file the default port is setup to 5433 instead of >> 5432 as previously... > > OK - you probably had two versions of PG installed at some point - when > you install

Re: [GENERAL] Bad pg_dump error message

2012-09-17 Thread Jasen Betts
On 2012-09-11, Mike Christensen wrote: > Is the TAR format just the raw SQL commands, just tar'ed and then sent > over the wire? It'd be cool if there was some compressed "binary" > backup of a database that could be easily downloaded, or even better, > a way to just move an entire database betw

Re: [GENERAL] Displaying image from php script displays string

2012-09-15 Thread Jasen Betts
On 2012-09-11, Raymond O'Donnell wrote: > > BTW, it's a REALLY bad idea to build literal SQL queries from input > values, as you're doing - you should use parameters and > pg_query_params() instead. Although (still) marked "experimental" pg_insert and pg_update work really well the more recent p

Re: [GENERAL] GRANT SELECT

2012-09-02 Thread Jasen Betts
On 2012-08-27, Stephen Crawford wrote: > Is there a simple way to grant SELECT privileges to a user for all the > tables in a database, without having to do it for each table? grant the role (membership of) a role that already has the priveleges. -- ⚂⚃ 100% natural -- Sent via pgsql-gener

[GENERAL] Re: C locale versus en_US.UTF8. (Was: String comparision in PostgreSQL)

2012-09-02 Thread Jasen Betts
On 2012-08-29, Bruce Momjian wrote: >> Name | Owner | Encoding | Collate |Ctype| >> Access privileges >> --+--+---+-+-+--- >> clocale_utf8 | smarlowe | UTF8 | C | en_US.UTF-8 | >> >>

Re: [GENERAL] CASE/WHEN behavior with NULLS

2012-09-02 Thread Jasen Betts
On 2012-09-01, Chris Angelico wrote: > On Sat, Sep 1, 2012 at 12:07 PM, David Johnston wrote: >> These are not equivalent if some values of foo are not-null and you want the >> sum of all non-null values while replacing any nulls with zero. So the >> decision depends on what and why you are su

Re: [GENERAL] At what point does a big table start becoming too big?

2012-08-23 Thread Jasen Betts
On 2012-08-22, Nick wrote: > I have a table with 40 million rows and haven't had any performance issues > yet. > > Are there any rules of thumb as to when a table starts getting too big? when you need to run a query that needs to fetch too many rows. > For example, maybe if the index size is 6x

[GENERAL] Re: Alternatives to very large tables with many performance-killing indicies?

2012-08-18 Thread Jasen Betts
On 2012-08-16, Wells Oliver wrote: > --0023543336c685451c04c7683ffb > Content-Type: text/plain; charset=ISO-8859-1 > > Hey folks, a question. We have a table that's getting large (6 million rows > right now, but hey, no end in sight). It's wide-ish, too, 98 columns. > > The problem is that each of

Re: [GENERAL] Smaller data types use same disk space

2012-08-04 Thread Jasen Betts
On 2012-07-25, Steve Crawford wrote: > > How are your determining the space used by a table? > > Why are you assuming 7 bytes for a 3-character value? (Character values > up to 126 characters long only have 1-character overhead.) character values upto 127 octets long only have one octet overhea

  1   2   3   4   >