[GENERAL] timestamps in Australia

2010-11-02 Thread Jasen Betts
set timezone to 'Australia/Sydney'; set timezone_abbreviations to 'Australia'; set datestyle to 'SQL,DMY'; select '2011-04-03 01:00'::timestamptz+generate_series(0,3)*'1h'::interval,generate_series(0,3); notice how the middle two look the same. (this is Australias DST change-back) This has th

Re: [GENERAL] Why Select Count(*) from table - took over 20 minutes?

2010-11-03 Thread Jasen Betts
On 2010-10-26, John R Pierce wrote: > > count(*) has to read the whole table to get the accurate count. The > reason for this is that different clients can see different versions of > that table, for instance, if client A is already in a transaction, and > client B then does an INSERT, the tw

Re: [GENERAL] avoiding nested loops when joining on partitioned tables

2010-11-06 Thread Jasen Betts
On 2010-10-31, Peter Neal wrote: > --0016363b85c479ce9d0493f14f93 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I have two tables (A and B), which are partitioned (A1, A2... B1, B2...) for > easy deletion of old records. They are linked by a bigint column "id", which > is defined as a

Re: [GENERAL] alter table add column - specify where the column will go?

2010-11-30 Thread Jasen Betts
On 2010-11-24, Daniel Verite wrote: > Fredric Fredricson wrote: > >> But if you change the column names in the second SELECT in the UNION this is >> ignored: >> # SELECT c1,c2 FROM (SELECT 1 AS c1, 2 AS c2 UNION SELECT 2 AS c3, 1 AS c4) >> AS x; >> c1 | c2 >> + >> 1 | 2 >> 2 |

Re: [GENERAL] Comparing first 3 numbers of a IPv4 address?

2010-11-30 Thread Jasen Betts
On 2010-11-20, Alexander Farber wrote: > > 1) if I'd like to compare just the first 3 numbers of > the IP address instead of the 4, how can I do it? > (yes, I know about the A,B,C type of IPv4 networks...) have you heard of CIDR (what about IPV6, which I'm going to ignore, but you should consid

Re: [GENERAL] finding rows with invalid characters

2010-11-30 Thread Jasen Betts
On 2010-11-21, Sim Zacks wrote: > I am using PG 8.2.17 with UTF8 encoding. > "PostgreSQL 8.2.17 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.1 > (Gentoo 4.1.1)" > > One of my tables somehow has invalid characters in it: >> ERROR: invalid byte sequence for encoding "UTF8": 0xa9 >> HINT: T

Re: [GENERAL] Do we want SYNONYMS?

2010-12-13 Thread Jasen Betts
On 2010-12-07, Andy Colson wrote: > I think it covers parts. In both you can create an alias to a table, > both of which you can fire off insert/update/delete. I assume in PG you > could have different permissions for the table and the alias, which I > assume you can do in oracle. > > If we

Re: [GENERAL] encode(bytea_value, 'escape') in PostgreSQL 9.0

2010-12-13 Thread Jasen Betts
On 2010-12-06, Florian Weimer wrote: > * Tom Lane: > >> Florian Weimer writes: >>> The old 'escape' encoding used by PostgreSQL 8.4 and prior was pretty >>> helpful for getting human-readable strings in psql. It seems this >>> functionality was removed in PostgreSQL 9.0. Was this an accident or

Re: [GENERAL] How to obtain the maximum value of a date, between 3 tables...

2010-12-16 Thread Jasen Betts
On 2010-12-08, Andre Lopes wrote: > --20cf3043476e053b5f0496e5ebc4 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I need to obtain the maximum value of a date, but that comparison will be > made between 3 tables... I will explain better with a query... you probably want greatest(d1,

Re: [GENERAL] if-clause to an exiting statement

2010-12-16 Thread Jasen Betts
On 2010-12-07, Kobi Biton wrote: > hi i am a newbie to sql statments , I am running postgres 8.1 with > application called opennms version 1.8.5 due to an application bug > queries that I execute aginst the DB which returns raw-count=0 are being > ignored and will not process a certain trigger I

Re: [GENERAL] Getting number of affected rows after DELETE FROM

2010-12-19 Thread Jasen Betts
On 2010-12-17, Raimon Fernandez wrote: > Hi, > > I'm trying to solve what I think must be a real trivial question. > > When I use psql after every DELETE FROM table WHERE id= I get how many > rows were affected, in this case, deleted. > > Also I've implemented the full FrontEnd/BackEnd Protoc

[GENERAL] Re: INSERT INTO...RETURNING with partitioned table based on trigger function

2010-12-19 Thread Jasen Betts
On 2010-12-16, pgsql.30.miller_2...@spamgourmet.com wrote: > --0015174c1e4aaf077604977d7e62 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi - > > Issue: > How to return a sequence value generated upon INSERT of records into a > partitioned table using trigger functions (without having t

Re: [GENERAL] Maximum size for char or varchar with limit

2010-12-19 Thread Jasen Betts
On 2010-12-08, Tom Lane wrote: > Adrian Klaver writes: >> On 12/08/2010 08:04 AM, Tom Lane wrote: >>> The rationale for having a limit of this sort is (a) we *don't* want >>> the upper limit of declarable length to be encoding-dependent; and >>> (b) if you are trying to declare an upper limit tha

Re: [GENERAL] Understanding Schema's

2010-12-23 Thread Jasen Betts
On 2010-12-15, Carlos Mennens wrote: > On Tue, Dec 14, 2010 at 7:17 PM, Joshua D. Drake > wrote: >> You can cross query a schema but not a database. >> >> So you can create: >> >> create table fire.foo() >> create table ice.foo() >> >> And they are isolated from each other physically and logical

Re: [GENERAL] Understanding Schema's

2010-12-23 Thread Jasen Betts
On 2010-12-15, Craig Ringer wrote: > On 12/15/2010 08:08 AM, Carlos Mennens wrote: >> I've recently switched from MySQL& have read the documentation for >> 'schema's' however I guess I'm just not at that level or really daft >> when it comes to database design. > > In terms of the way they work a

Re: [GENERAL] When the trigger is called my application is awaiting the finish

2010-12-23 Thread Jasen Betts
On 2010-12-16, fel...@informidia.com.br wrote: > This is a multi-part message in MIME format. > --080402070005010104020405 > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > Content-Transfer-Encoding: quoted-printable > > Hello, > I'm having a problem running an update com

Re: [GENERAL] Data backup to local duplicate without resetting permissions

2010-12-23 Thread Jasen Betts
On 2010-12-23, gvim wrote: > What's the easiest way, in PostgreSQL 9.0, to keep a duplicate > database on my local machine updated at intervals from another on a > remote machine without having to reset permissions after a > backup/restore. create roles matching the names of the remote roles and

Re: [GENERAL] How to calculate length of path data without diagonals?

2010-12-23 Thread Jasen Betts
On 2010-12-23, Romain Billoir wrote: > --0015175ccf48e6186a049817fc59 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, i need to calculate some length of path without diagonal. Some examples: > length((5,5),(6,6))) returns 1.41. I need 2: 5,5 to 5,6 + 5,6 to 6,6. > > Is that possible? It's

Re: [GENERAL] why update is slower on my pc?

2010-12-27 Thread Jasen Betts
On 2010-12-26, sunpeng wrote: > First I wondered whether the write speed on pc is lower than laptop, so i > use a cp command to test a write speed: that is often a test of read speed only. as the writes will be cached. -- ⚂⚃ 100% natural -- Sent via pgsql-general mailing list (pgsql-general@

Re: [GENERAL] DATA Location

2010-12-29 Thread Jasen Betts
On 2010-12-28, Ozz Nixon wrote: > Is it possible (and how) to implement a data path on another partition > (linux) for an existing system? And then if I do not gain anything, merging > it to the production /data path? tablespaces > Scenario of what I want to achieve (/mnt/data is already runni

Re: [GENERAL] Restore problem

2010-12-29 Thread Jasen Betts
On 2010-12-29, Bob Pawley wrote: > Yes I was just looking at it. > > It seems that it was dumped in that form. > > Any thoughts on how that could happen?? Not that it will help in this > instance. could be EOL problem. LF vs CRLF but I expect that would be merely cosmetic. -- Sent via pgsql-g

Re: [GENERAL] Overriding default psql behavior | how to ignore missing fields

2010-12-31 Thread Jasen Betts
On 2010-12-31, Håvard Wahl Kongsgård wrote: > --90e6ba488359a7721f0498b43825 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > Hi, > I am trying to insert new records from multiple SQL dumps into an existing > table. My problem is that the database ta

Re: [GENERAL] Merging 2 rows in a table

2011-01-03 Thread Jasen Betts
On 2011-01-03, Alexander Farber wrote: > Hello, > > through some obscure error (probably on my side) > Column | Type |Modifiers > +---+- > id | character varying(32) | > money | integer

Re: [GENERAL] UUID column as pimrary key?

2011-01-06 Thread Jasen Betts
On 2011-01-05, Scott Ribe wrote: > On Jan 5, 2011, at 9:01 AM, Tom Lane wrote: > >> In practical use I think the odds of a collision are *far* higher than >> you are suggesting, unless the UUID generation is being done with a lot >> more care than is likely if the user takes these sorts of claims

Re: [GENERAL] UUID column as pimrary key?

2011-01-08 Thread Jasen Betts
On 2011-01-06, Chris Browne wrote: > (Sequence + Host Data), and I'd expect there to > be a considerable risk of Dumb Techs making mistakes there. It wouldn't > be difficult for such a scenario to induce systematic key collisions. I've seen that happen. cleanup of the effected records was trick

Re: [GENERAL] Class dependencies

2011-01-10 Thread Jasen Betts
On 2011-01-10, Joel Jacobson wrote: > Hi, > > Is it safe to assume all objects of a given class can be > dropped/created, provided all objects of a list of other classes have > already been dropped/created? > > I'm looking at http://developer.postgresql.org/pgdocs/postgres/catalogs.html > > For ea

Re: [GENERAL] migrate hashname function from 8.1.x to 8.4

2011-01-14 Thread Jasen Betts
On 2011-01-11, =?utf-8?Q?Nicol=C3=A1s_Garfinkiel?= wrote: > Violence aside, thanks for your answer. The C module is what I was > planning to do, but was not sure if there is another way. Of course > using crypt would be the right thing to do, but I cannot afford it, as > users from our system c

Re: [GENERAL] Time Series on Postgres (HOWTO?)

2011-01-14 Thread Jasen Betts
On 2011-01-15, bubba postgres wrote: > --000e0cd332267ac2e60499d7ceb2 > Content-Type: text/plain; charset=ISO-8859-1 > > I've been googling, but haven't found a good answer to what I should do if I > want to store time series in Postgres. > It would be nice if I could use 1 sample per column,(bec

Re: [GENERAL] How to generate unique invoice numbers for each day

2011-01-15 Thread Jasen Betts
On 2011-01-15, Andrus Moor wrote: > Invoice numbers have format yymmddn > > where n is sequence number in day staring at 1 for every day. > > command > > SELECT COALESCE(MAX(nullif(substring( substring(tasudok from 7), > '^[0-9]*'),'')::int),0)+1 > FROM invoice > where date= ?invoicedate > > is

Re: [GENERAL] Trigger Performance

2011-01-15 Thread Jasen Betts
On 2011-01-15, Randall Smith wrote: > Hi, > > I've created a trigger that checks the uniqueness of two columns in a > table. Traditionally, one would use a unique constraint, but in my > case, the size of the unique index would be too large and some > performance loss is acceptable. However, the

Re: [GENERAL] Trigger Performance

2011-01-17 Thread Jasen Betts
On 2011-01-16, Randall Smith wrote: > Before reading. This is solved. Was an error on my part. > > On Sun, 2011-01-16 at 03:46 +0000, Jasen Betts wrote: >> In plpgsql IF is an implicit select. >> <http://www.postgresql.org/docs/8.4/interactive/plpgsql-expressions.

Re: [GENERAL] Trigger Performance

2011-01-17 Thread Jasen Betts
On 2011-01-17, Fredric Fredricson wrote: > This is a multi-part message in MIME format. > --00060003050104030402 > Content-Type: text/plain; charset=UTF-8; format=flowed > Content-Transfer-Encoding: 7bit > > On 01/15/2011 11:52 PM, Randall Smith wrote: >> Hi, >> >> I've created a t

Re: [GENERAL] Moving from SQL Anywhere to PostGres - First Time

2011-01-25 Thread Jasen Betts
On 2011-01-20, Robert Paresi wrote: > Hello, > > We have 700 user install base using Sybase SQL Anywhere 9.02 > > We are looking at migrating these installations over to PostGres > 1. Very Very Short Answer Please - why should we? postgres is the best database in the universe. :) > 2. Does an

Re: [GENERAL] error while trying to change the database encoding on a database

2011-01-28 Thread Jasen Betts
On 2011-01-24, Geoffrey Myers wrote: > Adrian Klaver wrote: > Thanks for the suggestion. As it stands, we are getting different > errors for different hex characters, thus the solution we need is the > ability to identify the characters that won't convert from SQL_ASCII to > UTF8. Is there a

Re: [GENERAL] Dumpall without OID

2011-01-28 Thread Jasen Betts
On 2011-01-27, Girts Laudaks wrote: > Hi, > > What could be the possible damage if a database is migraged without the > -o (OID) option? Integrity of data? some things that used OID might fail to work. Postgres doesn't need them, does your application? > What are the options to solve this probl

Re: [GENERAL] How to get TimeZone name?

2011-01-28 Thread Jasen Betts
On 2011-01-18, ar...@esri.com wrote: > Hi, > > How can I get timezone name? > I can get timezone offset but I could not find any reference of timezone > name. Change your datestyle setting, a setting of ISO gives nice portable offsets that will work the same anywhere in the world. a setting of

Re: [GENERAL] searching for characters via the hexidecimal value

2011-01-28 Thread Jasen Betts
On 2011-01-24, Geoffrey Myers wrote: > Massa, Harald Armin wrote: > > This does not work for me, but if I convert the hex value to octal this > does work: > > select comments from fax where comments ~* E'\231'; > you can do hex like this: select comments from fax where comments ~* E'\x99'; or

[GENERAL] Re: Separating the ro directory of the DB engine itself from the rw data areas . . .

2011-01-28 Thread Jasen Betts
On 2011-01-24, Albretch Mueller wrote: > ~ > I need to configure postgreSQL in a way that I could run it from a > directory mounted as read only, with separate rw partitions mounted > for the data, logs, . . . > ~ > What would be the steps to follow and the issues to take into consideration? fi

[GENERAL] Re: Separating the ro directory of the DB engine itself from the rw data areas . . .

2011-01-28 Thread Jasen Betts
On 2011-01-24, Albretch Mueller wrote: > ... better yet; is it possible to configure postgreSQL in a way that > it depends on external variables set via the OS in the same process > in which it is started? Debian manages that somehow. I've got two 8.4 clusters running and only one copy of the b

Re: [GENERAL] Store base64 in database. Use bytea or text?

2011-01-28 Thread Jasen Betts
On 2011-01-26, Bill Moran wrote: > DO NOT use parametrized queries with PHP and bytea (I hate to say that, > because parametrized fields are usually a very good idea). PHP has a > bug that mangles bytea data when pushed through parametrized fields. > > PHP bug #35800 OOTOH pg_insert() and pg_up

Re: [GENERAL] resizing a varchar column on 8.3.8

2011-01-28 Thread Jasen Betts
On 2011-01-27, Emi Lu wrote: > On 01/15/2011 04:22 PM, Jon Hoffman wrote: >> Hi, >> >> I found a post with some instructions for resizing without locking up >> the table, but would like to get some re-assurance that this is the best >> way: >> >> http://sniptools.com/databases/resize-a-column-in-a

Re: [GENERAL] Store base64 in database. Use bytea or text?

2011-01-28 Thread Jasen Betts
On 2011-01-28, Dmitriy Igrishin wrote: > --001636c598d9470a92049ae97be4 > Content-Type: text/plain; charset=UTF-8 > > 2011/1/28 Andre Lopes > >> Hi, >> >> Another question about this subject. >> >> It is possible to cache this images from the database? In the future I >> will need to cache the pi

[GENERAL] win Locales - "Arabic, Gum"

2011-02-03 Thread Jasen Betts
What's the deal with locale codes on windows. especially the settings like LC_NUMERIC ansd LC_MONETARY on windows XP in 9.0 "show LC_MONETARY" displays them as "Arabic, Bharain" or "English, UK", "French, Canada" but everything right of the comma seems to be ignored. (resulting in incorrect cur

Re: [GENERAL] How to create index on only some of the rows

2011-02-14 Thread Jasen Betts
On 2011-02-07, A B wrote: > Hello. > > How do you create an index for only some of the rows in a table? I > read in the docs: > > "The expression used in the WHERE clause can refer only to columns of > the underlying table, but it can use all columns, not just the ones > being indexed. Presently,

Re: [GENERAL] PostgreSQL For Beginners

2011-02-19 Thread Jasen Betts
On 2011-02-03, Kenneth Buckler wrote: > One of the programmers I work with is interested in migrating from > Oracle to PostgreSQL as the backend for his applications. > > Is there a PostgreSQL "beginners" guide available somewhere, which > might help him understand setting up a test database on h

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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, 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] 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] 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 -

[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-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

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] 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] .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] 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] 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-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-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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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

  1   2   3   4   >