Re: [GENERAL] execute same query only one time?

2016-02-09 Thread Harald Fuchs
Johannes writes: >> What the reason to execute all statements which return different >> columns at once? >> >>> Saving roundtrips, >> >> In most cases they are not so big. Getting a bunch of duplicated data >> is wasting you network bandwidth and don't increase speed. > > In my and your example

[GENERAL] log_min_duration question

2016-02-08 Thread Harald Fuchs
>From the 9.5 docs: log_min_duration_statement (integer) Causes the duration of each completed statement to be logged if the statement ran for at least the specified number of milliseconds. Setting this to zero prints all statement durations. Minus-one (the default) disables logging sta

Re: [GENERAL] Is PRIMARY KEY the same as UNIQUE NOT NULL?

2016-01-31 Thread Harald Fuchs
Ben Leslie writes: > "Technically, PRIMARY KEY is merely a combination of UNIQUE and NOT NULL" > > I wanted to clarify if that was, technically, true. Yes, but see below. > "identifying a set of columns as primary key also provides metadata > about the design of the schema, as a primary key imp

Re: [GENERAL] “Loop” in plpgsql Function - PostgreSQL 9.2

2016-01-19 Thread Harald Fuchs
"drum.lu...@gmail.com" writes: > So, the new plan is: > > 1 - Select 50.000 rows and gives it a batch number. > 2 - Select *MORE* 50,000 rows and gives it a *NEW* batch number. > 3 - Select *MORE* 50,000 rows and gives it a *NEW* batch number. Why so complicated? Here's a simplified example:

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread Harald Fuchs
Thomas Kellerer writes: > I always wonder whether it's more efficient to aggregate this path > using an array rather than a varchar. Mainly because representing the > numbers as varchars will require more memory than as integer, but then > I don't know the overhead of an array structure and wheth

Re: [GENERAL] Controlling complexity in queries

2011-12-15 Thread Harald Fuchs
Jay Levitt writes: > * You want contextual queries. > > (I guess this is a special case of "you need non relational features".) > > In my case, I want all queries against content to be filtered by their > relevance to the current user. That can't go into a view, because > views don't have paramet

Re: [GENERAL] Oddball data distribution giving me planner headaches

2011-12-03 Thread Harald Fuchs
Jeff Amiel writes: >> At the moment I think the only way to work around this is >> to denormalize >> your schema a bit. > And I feared as much. > It's biting me in other areas as well...this unusual distribution of > data...certain types of customers have completely different data patterns > t

Re: [GENERAL] How to get normalized data from tekst column

2011-11-24 Thread Harald Fuchs
"Andrus" writes: > David, >>Regular Expressions are your friend here. If you do not know them you > should learn them; though if you ask nicely someone may just provide you > the solution you need. >>Split-to-array and unnest may work as well. > > Thank you very much. I dona**t know regexps. >

Re: [GENERAL] What about improving the rules system we have, was Re: Rules going away

2011-09-28 Thread Harald Fuchs
In article <4116.1317226...@sss.pgh.pa.us>, Tom Lane writes: > Not sure this specific proposal makes any sense at all. IMO the only > real advantage that rules have over triggers is that they work on a > set-operation basis not a tuple-by-tuple basis. Isn't that what statement-level triggers ar

Re: [GENERAL] Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?

2011-09-27 Thread Harald Fuchs
In article , Marti Raudsepp writes: > Ah, the reverse() function is not included with PostgreSQL 9.0 yet. > This is what I use: > CREATE FUNCTION reverse(input text) RETURNS text > LANGUAGE plpgsql IMMUTABLE STRICT AS $$ > DECLARE > result text = ''; > i int; > BEGIN > FOR i IN 1..length(i

Re: [GENERAL] New feature: accumulative functions.

2011-09-26 Thread Harald Fuchs
In article , Pavel Stehule writes: > 2011/9/25 pasman pasmański : >> I found second use case. Look at expression: >> >> where left(str,n)='value' >> >> function left(str,n) increase monotonically for str and n. With this >> feature it can use index on str. >> >> Classic index needs recreating

Re: [GENERAL] Column Privileges: NULL instead of permission denied

2011-09-20 Thread Harald Fuchs
In article , Matthew Hawn writes: > I have a table with privileged data that is restricted using column level > permissions. I would like to have single query that returns data from > the table. If the user has permission, it should return the data but > return NULL if the user does not have p

Re: [GENERAL] PostgreSQL 9.1.0 bug?

2011-09-16 Thread Harald Fuchs
In article <21641.1316159...@sss.pgh.pa.us>, Tom Lane writes: > Harald Fuchs writes: >> I think I've found a bug either in PostgreSQL 9.1.0 or in the ip4r >> package (version 1.05). > Good catch --- gistendscan is forgetting to free so->giststate. Confirmed

[GENERAL] PostgreSQL 9.1.0 bug?

2011-09-15 Thread Harald Fuchs
I think I've found a bug either in PostgreSQL 9.1.0 or in the ip4r package (version 1.05). Since the problematic behavior occurs on different tables and on different servers, it should be relatively easy to reproduce: CREATE TABLE foo ( id serial NOT NULL, range ip4r NOT NULL, PRIMARY KEY (

Re: [GENERAL] Bit datatype performance?

2011-09-15 Thread Harald Fuchs
In article , Antonio Vieiro writes: > Hi all, > One of my entities 'E' may be 'tagged' with an arbitrary set of 256 tags 'T'. > A first approach could be to add a M:N relationship between 'E' and 'T'. > A second way to do this could be to add a BIT(256) datatype to 'E', > setting bits to '1' if

Re: [GENERAL] join between a table and function.

2011-08-16 Thread Harald Fuchs
In article , Lauri Kajan writes: > I have also tried: > select > *, getAttributes(a.id) > from > myTable a > That works almost. I'll get all the fields from myTable, but only a > one field from my function type of attributes. > myTable.id | myTable.name | getAttributes > integer | charact

Re: [GENERAL] hstore installed in a separate schema

2011-08-04 Thread Harald Fuchs
In article <1312401318.5199.yahoomailclas...@web120108.mail.ne1.yahoo.com>, Ioana Danes writes: > Hi, > I am planning to use the contrib module hstore > but I would like to install it on a separate schema, not public, > and include the schema in the search_path. > Do you know if there are any

Re: [GENERAL] Difference between inet and cidr

2011-07-05 Thread Harald Fuchs
In article , Marti Raudsepp writes: > Hi, > On Tue, Jul 5, 2011 at 09:50, Yan Cheng CHEOK wrote: >> The essential difference between inet and cidr data types is that inet >> accepts values with nonzero bits to the right of the netmask, whereas cidr >> does not. > Say, if you have a /8 netmask

Re: [GENERAL] Select from Java Strings

2011-07-04 Thread Harald Fuchs
In article <4e116e11.1030...@gmail.com>, Daron Ryan writes: > Hello David, > This is a simplified version of my own attempt: > SELECT * > FROM ("oxford", "webster") > WHERE NOT ( columnName = ANY (SELECT name FROM dictionaries)) > The idea is that "oxford" and "webster" come from the Java progr

Re: [GENERAL] Adding a default value to a column after it exists

2011-04-14 Thread Harald Fuchs
In article <20110413163120.gu24...@shinkuro.com>, Andrew Sullivan writes: > On Wed, Apr 13, 2011 at 09:21:20AM -0700, Gauthier, Dave wrote: >> Is there a way to add a default value definition to an existing column? >> Something like an "alter table... alter column... default 'foo'". > ALTER TA

Re: [GENERAL] Advice needed on application/database authentication/authorization/auditing model

2010-10-24 Thread Harald Fuchs
In article <20101022161331.gd9...@frohike.homeunix.org>, Peter Bex writes: > As far as I can see, this would imply either creating views on the > for every user (or company?), or manually crafting queries > to do the same. Not necessarily. Consider this: CREATE TABLE t1 ( id serial NOT N

Re: [GENERAL] Constraint: string length must be 32 chars

2010-10-17 Thread Harald Fuchs
In article <4cba2bc4.9030...@darrenduncan.net>, Darren Duncan writes: > I would further recommend turning the above into a separate data type, > especially if you'd otherwise be using that constraint in several > places, like this ... FWIW, the shatypes contrib package includes a binary md5 data

Re: [GENERAL] Prefix LIKE search and indexes issue.

2010-07-25 Thread Harald Fuchs
In article , Marcelo de Moraes Serpa writes: > Some good souls hinted me at the prefix extension, but > how would I use it? Like this: CREATE TABLE users ( id serial NOT NULL, name text NOT NULL, reversed_domain prefix_range NULL, PRIMARY KEY (id) ); CREATE INDEX users_dom_ix ON users

Re: [GENERAL] index scan and functions

2010-07-20 Thread Harald Fuchs
In article <20100719162547.ga17...@localhost>, arno writes: > Thanks, that's exactly what I was looking for. No, I'd say you're looking for the ip4r package which provides an indexable IP address range type. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-09 Thread Harald Fuchs
In article <4c0f4ba8.3040...@gmail.com>, Ognjen Blagojevic writes: > Plenty of solutions here: > http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ This doesn't mention the incredibly powerful windowing functions of PostgreSQL >= 8.4.0: SELECT username,

Re: [GENERAL] Ltree - how to sort nodes on parent node

2010-04-20 Thread Harald Fuchs
In article <1f96e061-713c-4929-a7d9-278e5b608...@solfertje.student.utwente.nl>, Alban Hertroys writes: > On 20 Apr 2010, at 18:05, Harald Fuchs wrote: >> Here's a working version: >> >> WITH RECURSIVE tree (path, category, sort_order, parent) AS ( >> SELEC

Re: [GENERAL] Ltree - how to sort nodes on parent node

2010-04-20 Thread Harald Fuchs
In article <59670b22-30cb-4e6e-83c8-c1d1036c9...@solfertje.student.utwente.nl>, Alban Hertroys writes: > 2). Drop the ltree column and go with a truly recursive approach, something > like this: > CREATE TABLE node ( > categorytextNOT NULL PRIMARY KEY, > sort_order i

[GENERAL] Large Object leakage

2010-04-01 Thread Harald Fuchs
I have a DB (mydb) where one table (mytbl) contains a large object column. The contents are managed by contrib/lo. This breaks when I want to copy the DB to another host where the schema is already present with some old contents: when I do pg_dump -c mydb | psql -q -h otherhost mydb -f - pg_

Re: [GENERAL] plPgSQL + CDIR/INET types ...

2010-03-31 Thread Harald Fuchs
In article , "Marc G. Fournier" writes: > Has anyone either played with, or gotten to work, a plPgSQL function > that would take: 192.168.1.1/24 and determine the start and end IP > from that? Or even start IP + # of IPs in the subnet? Just install ip4r from pgfoundry, and you'll never look bac

Re: [GENERAL] How to perform text merge

2010-03-29 Thread Harald Fuchs
In article <609bf3ce079445569fc0d047a5c81...@andrusnotebook>, "Andrus" writes: > Database column contains merge data in text column. > Expressions are between << and >> separators. > How to replace them with database values ? > For example, code below should return: > Hello Tom Lane! > How to

[GENERAL] regexp_replace puzzle

2010-03-10 Thread Harald Fuchs
I've got a problem with regexp_replace which I could reduce to the following: CREATE FUNCTION digest(text, text) RETURNS bytea LANGUAGE c IMMUTABLE STRICT AS '$libdir/pgcrypto', 'pg_digest'; CREATE FUNCTION sha224enc(text) RETURNS text AS $$ BEGIN RAISE WARNING 'arg=»%«', $1

Re: [GENERAL] DROP column: documentation unclear

2010-03-09 Thread Harald Fuchs
In article <20100308213549.gb...@svana.org>, Martijn van Oosterhout writes: >> "subsequent ... will store a null value" would imply that deleted columns >> will still take some place, while "the space will be reclaimed ..." would >> suggest that new rows (insert or updates in mvcc) don't have t

Re: [GENERAL] Large Objects: Sizeof and Deleting Unlinked LOs

2010-02-11 Thread Harald Fuchs
In article <4b72aeb3.4000...@selestial.com>, Howard Cole writes: > Is there an SQL function to determine the size of a large object? I'm using a pgsql helper function for that: CREATE FUNCTION lo_size(oid oid) RETURNS integer LANGUAGE plpgsql AS $$ DECLARE fd int; res i

Re: [GENERAL] Statement level triggers

2010-01-20 Thread Harald Fuchs
In article <4b5702b9.50...@postnewspapers.com.au>, Craig Ringer writes: >> What'd be the behavior of a (plpgsql) trigger function when called as >> a statement level trigger? >> Let's say that a statement will involve more than one row. >> The documentation (v8.4.2, "35.1. Overview of Trigger Beh

Re: [GENERAL] regexp_matches() quantified-capturing-parentheses oddity

2009-12-08 Thread Harald Fuchs
In article <13289.1260290...@sss.pgh.pa.us>, Tom Lane writes: > Julian Mehnle writes: >> So far, so good. However, can someone please explain the following to me? >> wisu-dev=# SELECT regexp_matches('q...@foo@bar.zip', '([...@.]|[...@.]+)+', >> 'g'); >> wisu-dev=# SELECT regexp_matches('q...@f

Re: [GENERAL] pgsql 'prefix' error

2009-11-25 Thread Harald Fuchs
In article <87tywid19x@hi-media-techno.com>, Dimitri Fontaine writes: > The BTree opclass is not made to resist to overlapping data. Maybe in > this case though we could say that 12 contains less elements than 1 so > it's less than 1. Here's a test to redefine the pr_cmp() operator in > term

Re: [GENERAL] pgsql 'prefix' error

2009-11-24 Thread Harald Fuchs
In article <4b0bbc8e.6010...@indoakses-online.com>, Bino Oetomo writes: > I downloaded pgfoundry's prefix, postgresql-8.3-prefix_1.0.0-1_i386.deb > I install it using dpkg , and run the prefix.sql > Create database .. named 'prefbino', and > CREATE TABLE myrecords ( > record prefix_range NOT N

Re: [GENERAL] How is the right query for this condition ?

2009-11-23 Thread Harald Fuchs
In article <5a9699850911222009j272071fbi1dd0c40dfdf62...@mail.gmail.com>, Brian Modra writes: > 2009/11/23 Bino Oetomo : >> Dear All >> >> Suppose I created a database with single table like this : >> --start-- >> CREATE DATABASE bino; >> CREATE TABLE myrecords(record text); >> -

Re: [GENERAL] cidr data type question

2009-11-02 Thread Harald Fuchs
In article <1257149236.3426.9.ca...@localhost>, Vasiliy G Tolstov writes: > Hello. > I have table with cidr data type column (table is white/black list of > networks). > Does it possible to query - is the some address contains in any cidr > network in this table? (for all networks in the table

Re: [GENERAL] How to match sets?

2009-09-13 Thread Harald Fuchs
In article , Alban Hertroys writes: > An example of the two sets I need to "join" are, at the left hand side: > unit | token | exponent > ---+---+-- > m.s^-1 | m | 1 > m.s^-1 | s | -1 > m.s^-2 | m | 1 > m.s^-2 | s | -2 > And at the right hand side: > token | ex

Re: [GENERAL] unique index for periods

2009-08-20 Thread Harald Fuchs
In article <20090820065819.ga2...@gheift.kawo1.rwth-aachen.de>, Gerhard Heift writes: > Hello, > I try to create an unique index for a (time)period, and my goal is to > prevent two overlapping periods in a row. > ... > Is there another solution to solve my problem? Have a look at http://pgfoun

Re: [GENERAL] Generating random unique alphanumeric IDs

2009-08-17 Thread Harald Fuchs
In article <20090816122526.gw5...@samason.me.uk>, Sam Mason writes: > I've just had a look and PG does actually seem to be returning values as > I'd expect, i.e. 0 <= n < 1. That's what everyone would expect. If it's really implemented like that the documentation is wrong, isn't it? -- Sent

Re: [GENERAL] Refer to another database

2009-08-04 Thread Harald Fuchs
In article <4a77c4af.2060...@gmx.de>, Andreas Kalsch writes: > To be completely > in context of a schema - so that I can use all tables without the > prefix - I have to reset the search_path very often. Why? Just say "ALTER DATABASE foo SET search_path = public, bar, baz" once and you're done.

Re: [GENERAL] Return LEFT JOINed tables when one has no matching column

2009-06-24 Thread Harald Fuchs
In article <4a425379.90...@alteeve.com>, Madison Kelly writes: > SELECT > a.tbl1_name, > b.tbl2_date, > c.tbl3_value AS some_value > FROM > table_1 a > LEFT JOIN > table_2 b ON (a.tbl1_id=b.tbl2_tbl1_id) > LEFT JOIN > table_3 c ON (a.tbl1_id=c.tbl3_tbl1_id) > W

Re: [GENERAL] WITH RECURSIVE clause -- all full and partial paths

2009-06-12 Thread Harald Fuchs
In article , aryoo writes: > Dear list, > In reference to the message below posted on the 'pgsql-hackers' list regarding > 'iterative' queries, > could anyone help me write the queries that return all full and all partial > paths from the root? Probably you want to use the following query: WI

Re: [GENERAL] Help with join syntax sought

2009-05-20 Thread Harald Fuchs
In article <43639.216.185.71.24.1242834374.squir...@webmail.harte-lyne.ca>, "James B. Byrne" writes: > What I want to be able to do is to return the most recent rate for > all unique rate-pairs, irrespective of type. I also have the > requirement to return the 5 most recent rates for each rate-p

Re: [GENERAL] [GENEAL] dynamically changing table

2009-03-31 Thread Harald Fuchs
In article <437faa9f-df2d-429e-9856-eb2026b55...@solfertje.student.utwente.nl>, Alban Hertroys writes: > On Mar 30, 2009, at 5:39 PM, A B wrote: >> Hi, >> In the next project I'm going to have a number of colums in my tables, >> but I don't know how many, they change. They all use integers as >>

Re: [GENERAL] Convert Arbitrary Table to Array?

2009-02-09 Thread Harald Fuchs
In article <17050.1234200...@sss.pgh.pa.us>, Tom Lane writes: > Lee Hughes writes: >> Hi, I need a function that accepts a table name and returns a 2-dimensional >> array of the table data. > Well, in 8.3 and up there are arrays of composite types, so you can > do something like >

Re: [GENERAL] Array, bytea and large objects

2009-02-05 Thread Harald Fuchs
In article <4989e659.3000...@computer.org>, David Wall writes: > If I have an "unlimited" number of name-value pairs that I'd like to > get easy access to for flexible reports, could I store these in two > arrays (one for name, the other for value) in a table so that if I had > 10 name-value pair

Re: [GENERAL] Call volume query

2009-01-30 Thread Harald Fuchs
In article <1233269836.13476.10.ca...@ubuntu>, Mike Diehl writes: > Hi all. > I've encountered an SQL problem that I think is beyond my skills... > I've got a table full of records relating to events (phone calls, in > this case) and I need to find the largest number of events (calls) > occurrin

Re: [GENERAL] selecting recs based on a tmp tbl vals that are wildcarded ?

2009-01-08 Thread Harald Fuchs
In article <482e80323a35a54498b8b70ff2b8798003e5ac7...@azsmsx504.amr.corp.intel.com>, "Gauthier, Dave" writes: > I have a temp table containg wildcarded strings and I want to select values > froma different table using ?like? against all those wildcarded values. > Here?s > the example... > cr

Re: [GENERAL] cumulative count

2008-12-04 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Carson Farmer <[EMAIL PROTECTED]> writes: > date | user > --+- > 20050201 | Bill > 20050210 | Steve > 20050224 | Sally > 20050311 | Martha > 20050316 | Ryan > 20050322 |

Re: [GENERAL] Redefining an existing Table Schema for Foreign Key Constraint - Question

2008-11-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Michelle Konzack <[EMAIL PROTECTED]> writes: > Hallo Harald, > Am 2008-11-03 13:41:52, schrieb Harald Fuchs: >> In article <[EMAIL PROTECTED]>, >> Brian714 <[EMAIL PROTECTED]> writes: >> > Customers Table >&g

Re: [GENERAL] Redefining an existing Table Schema for Foreign Key Constraint - Question

2008-11-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Brian714 <[EMAIL PROTECTED]> writes: > Currently, the database contains thousands of records in the Customers and > Creditcards tables. I would like to re-define the Customers table to follow > the following schema: > Customers Table > id:integer -- primary key > f

Re: [GENERAL] Query m:n-Combination

2008-10-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ludwig Kniprath <[EMAIL PROTECTED]> writes: > Dear list, > I have to solve a simple Problem, explained below with some sample-Data. > A typical M:N-constellation, rivers in one table, communities in the > other table, m:n-join-informations (which river is running i

Re: [GENERAL] OR or IN ?

2008-10-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "A. Kretschmer" <[EMAIL PROTECTED]> writes: > am Tue, dem 14.10.2008, um 8:33:21 +0200 mailte Luca Ferrari folgendes: >> Hi all, >> I've got a query with a long (>50) list of ORs, like the following: >> >> SELECT colB, colC FROM table WHERE colA=X OR colA=Y OR co

Re: [GENERAL] Converting string to IN query

2008-09-17 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Andrus" <[EMAIL PROTECTED]> writes: > I found that following query works: > create temp table test ( test int ) on commit drop; > insert into test values(1); > select * from test where test = ANY ( '{1,2}' ); > Is this best solution ? > Will it work without causi

Re: [GENERAL] psql scripting tutorials

2008-09-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Greg Smith <[EMAIL PROTECTED]> writes: > On Tue, 9 Sep 2008, Artacus wrote: >> Can psql access environmental variables or command line params? > $ cat test.sql > select :TEST as "input"; > $ psql -v TEST=16 -f test.sql > input > --- > 16 > (1 row) Nice tr

Re: [GENERAL] A challenge for the SQL gurus out there...

2008-09-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Uwe C. Schroeder" <[EMAIL PROTECTED]> writes: > or maybe not and I'm just not getting it. > So here's the scenario: > I have 3 tables > forum: with primary key "id" > forum_thread: again primary key "id" and a foreign key "forum_id" referencing > th primary key

Re: [GENERAL] generate_series woes

2008-04-16 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Merlin Moncure" <[EMAIL PROTECTED]> writes: > On Mon, Apr 14, 2008 at 5:21 AM, Harald Fuchs <[EMAIL PROTECTED]> wrote: >> I think there's something sub-optimal with generate_series. >> In the following, &

[GENERAL] generate_series woes

2008-04-14 Thread Harald Fuchs
I think there's something sub-optimal with generate_series. In the following, "documents" is a table with more than 12 rows, vacuumed and analyzed before the queries. EXPLAIN ANALYZE SELECT count (d.id), floor (s.val / 5000) FROM generate_series (1::INT, 5009) AS s (val) LEFT JOIN docu

Re: [GENERAL] Numbering rows by date

2008-04-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Andrus" <[EMAIL PROTECTED]> writes: > I have table > create Document ( docdate date, docorder integer ) > I need update docorder column with numbers 1,2 in docdate date order > Something like > i = 1; > UPDATE Document SET docorder = i++ > ORDER BY docdate; >

Re: [GENERAL] Problem with planner choosing nested loop

2008-04-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Rodrigo E. De León Plicet" <[EMAIL PROTECTED]> writes: > On Wed, Apr 2, 2008 at 12:36 PM, Alex Solovey <[EMAIL PROTECTED]> wrote: >> ... I have no idea how it could be fixed. > - CREATE INDEX xifoo ON foo(bar_id); > - ANALYZE; > - Retry. A compound index CREATE

Re: [GENERAL] Survey: renaming/removing script binaries (createdb, createuser...)

2008-03-27 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Tom Lane <[EMAIL PROTECTED]> writes: >> I note that we can continue to have the current executables stashed in >> PREFIX/share/libexec and let the "pg" executable exec them. > Not share/ surely, since these are executables, but yeah. > This brings me to the idea t

Re: [GENERAL] ISO something like "#if 0 ... #endif" for SQL code

2008-03-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alban Hertroys <[EMAIL PROTECTED]> writes: >> I'm thinking of something like the trick of surrounding C code with >> pairs of #if 0 and #endif, which effectively comments out code, >> even when it contains /* C-style comments */. >> >> Is there some similar trick f

Re: [GENERAL] Are indexes blown?

2008-02-15 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Shoaib Mir" <[EMAIL PROTECTED]> writes: > On Fri, Feb 15, 2008 at 6:13 PM, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > Thanks. But I had installed from rpm. Can I just download that .so > file and put in the lib folder for pgsql and then start using it?

Re: [GENERAL] 8.2/8.3 incompatibility

2008-02-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Stephan Szabo <[EMAIL PROTECTED]> writes: > On Thu, 7 Feb 2008, Harald Fuchs wrote: >> This works fine in 8.2.4, but 8.3.0 rejects the ALTER TABLE with the >> following (somewhat misleading) error message: >> >> ERROR:

[GENERAL] 8.2/8.3 incompatibility

2008-02-07 Thread Harald Fuchs
I've found an incompatibility between PostgreSQL 8.2.4 and 8.3.0 which is not clearly documented. Here's a short example: CREATE TABLE t1 ( id CHAR(5) NOT NULL, PRIMARY KEY (id) ); INSERT INTO t1 (id) VALUES ('t1id1'); INSERT INTO t1 (id) VALUES ('t1id2'); INSERT INTO t1 (id) V

Re: [GENERAL] Is news.postgresql.org down?

2008-01-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Rainer Bauer <[EMAIL PROTECTED]> writes: > Hopefully it won't be down for too long as I use a newsreader to read > the lists. I use www.gmane.org for that. ---(end of broadcast)--- TIP 9: In versions below 8.0, the

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Phil Rhoades <[EMAIL PROTECTED]> writes: > People, >> select count(*) as cnt, name from tst group by name having count(*) = 1 > This worked for my basic example but not for my actual problem - I get > "column comment must appear in the GROUP BY clause or be used i

Re: [GENERAL] count(*) and bad design was: Experiences with extensibility

2008-01-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Chris Browne <[EMAIL PROTECTED]> writes: > There may be a further optimization to be had by doing a > per-statement trigger that counts the number of INSERTs/DELETEs done, > so that inserting 30 tuples (in the table being tracked) leads to > adding a single tuple wi

Re: [GENERAL] Restart a sequence regularly

2007-11-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Richard Huxton <[EMAIL PROTECTED]> writes: > Kathy Lo wrote: >> On 11/21/07, Richard Huxton <[EMAIL PROTECTED]> wrote: >>> You probably shouldn't attach any meaning to the numbers from a sequence >>> - they're just guaranteed to be unique, nothing else. > What you

Re: [GENERAL] IP addresses

2007-11-19 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Tom Allison" <[EMAIL PROTECTED]> writes: > I am planning on doing a LOT of work with ip addresses and thought that the > inet data type would be a great place to start. Forget inet. Check out http://pgfoundry.org/projects/ip4r/ and be happy. ---

Re: [GENERAL] "Concatenate" two queries - how?

2007-10-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "A. Kretschmer" <[EMAIL PROTECTED]> writes: > am Wed, dem 24.10.2007, um 15:08:51 +0200 mailte Stefan Schwarzer folgendes: >> Now, I want to enable queries which display national as well as >> regional values. I could probably work with independent queries, but

Re: [GENERAL] Duplicate records returned

2007-06-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Richard Huxton <[EMAIL PROTECTED]> writes: >> $the_sql = " SELECT projectname, username, sum(hours)"; >> $the_sql .= " FROM timerecs"; >> $the_sql .= " WHERE projectname = projects.projectname "; >> $the_sql .= " AND projectname = restrictions.projectname"; >> $the

Re: [GENERAL] Importing *huge* mysql database into pgsql

2007-03-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, ".ep" <[EMAIL PROTECTED]> writes: > Hello, > I would like to convert a mysql database with 5 million records and > growing, to a pgsql database. > All the stuff I have come across on the net has things like > "mysqldump" and "psql -f", which sounds like I will be s

Re: [GENERAL] Postgres SQL Syntax

2007-02-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jim C." <[EMAIL PROTECTED]> writes: > Maybe it is and maybe it isn't. I wouldn't know. I'm merely the > unfortunate soul chosen to convert this from MySQL to Postgres. :-/ > I've been working on it for a week now. I've got to say that it pains me > to know that

Re: [GENERAL] psql substitution variables

2007-01-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Merlin Moncure" <[EMAIL PROTECTED]> writes: > can anybody think of of a way to sneak these into dollar quoted > strings for substitution into create function? > would i would ideally like to do is (from inside psql shell) > \set foo 500 > create function bar() r

Re: [GENERAL] PostgreSQL 8.2.0 and ip4r?

2006-12-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Martijn van Oosterhout writes: > Looking at CVS, line 967 is a blank line, so I have to ask what version > you're compiling. I notice the CVS tree got some patches two months ago > for 8.2 but there has been no release since then. Perhaps you should > try the lates

Re: [GENERAL] PostgreSQL 8.2.0 and ip4r?

2006-12-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Martijn van Oosterhout writes: > On Sat, Dec 09, 2006 at 12:10:16PM +0100, Harald Fuchs wrote: >> I would like to upgrade to PostgreSQL 8.2.0, but there's one thing >> stopping me: the need for ip4r (http://pgfoundry.org/projects/ip4r)

[GENERAL] PostgreSQL 8.2.0 and ip4r?

2006-12-09 Thread Harald Fuchs
I would like to upgrade to PostgreSQL 8.2.0, but there's one thing stopping me: the need for ip4r (http://pgfoundry.org/projects/ip4r). Has anyone managed to fix that? ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] How to use outer join in update

2006-12-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alban Hertroys <[EMAIL PROTECTED]> writes: > Andrus wrote: >> In my current DBMS I can use >> >> create table t1 ( f1 int, f2 int ); >> create table t2 ( f3 int, f4 int ); >> update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4 > That looks like a self-join

Re: [GENERAL] Dynamic partial index

2006-08-18 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, gustavo halperin <[EMAIL PROTECTED]> writes: > Hello > I'm interesting in a partial index for a rows that aren't older than > 6 mounts, something like the sentence below: > /CREATE INDEX name_for_the_index ON table > (the_column_of_type_date) WHERE ( the

Re: [GENERAL] Best approach for a "gap-less" sequence

2006-08-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Scott Ribe <[EMAIL PROTECTED]> writes: >> Why putting gapless numbers into the database at all? Just >> calculate them at query time. > There is ABSOLUTELY NO WAY that would be acceptable for accounting or legal > purposes. It would be the same as fabricating the

Re: [GENERAL] Best approach for a "gap-less" sequence

2006-08-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jorge Godoy <[EMAIL PROTECTED]> writes: > Harald Fuchs <[EMAIL PROTECTED]> writes: >> Why putting gapless numbers into the database at all? Just calculate them at >> query time. > And how would you retrieve the record that co

Re: [GENERAL] Best approach for a "gap-less" sequence

2006-08-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Richard Broersma Jr <[EMAIL PROTECTED]> writes: > I am curious, can you calculate something like this using only sql? Or you > you need to employee a > procedural language like plpsgql? You could use something like SELECT (SELECT count(*) FROM tbl t2 WHERE t2.i

Re: [GENERAL] Best approach for a "gap-less" sequence

2006-08-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jorge Godoy <[EMAIL PROTECTED]> writes: > AgentM <[EMAIL PROTECTED]> writes: >> Since the gapless numbers are purely for the benefit of the tax people, you >> could build your db with regular sequences as primary keys and then >> regularly >> (or just before tax-t

Re: [GENERAL] LISTEN considered dangerous

2006-08-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Flemming Frandsen <[EMAIL PROTECTED]> writes: >> I would still expect any >> reimplementation of notify messaging to honor the principle that a >> LISTEN doesn't take effect till you commit. > Naturally, the listen should not do anything at all when followed by a >

Re: [GENERAL] join on next row

2006-06-20 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Sim Zacks <[EMAIL PROTECTED]> writes: > I want my query resultset to be > Employee,EventDate(1),EventTime(1),EventType(1),EventTime(2),EventType(2) > Where Event(2) is the first event of the employee that took place > after the other event. > Example > EventIDE

Re: [GENERAL] SQL ASCII encoding

2006-04-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Martijn van Oosterhout writes: > As a british user, latin9 will cover most of your needs, unless > ofcourse someone wants to enter their name in chinese :) Since british users don't use French OE ligatures or Euro currency signs, even latin1 would do. --

Re: [GENERAL] partial resultset in java

2006-03-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Luckys <[EMAIL PROTECTED]> writes: > I believe you should restrict number of rows that needs to be returned, or > giving a choice to the user, although showing the total count. Even if you > display all 20K records, no one is going to see them all,  you can even add

Re: [GENERAL] referential integrity without trigger

2006-02-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alexander Presber <[EMAIL PROTECTED]> writes: > Hello everybody, > Assuming I want to empty and refill table A (with roughly the same > content, preferrably in one transaction) and don't want to completely > empty a dependent table B but still keep referential integ

Re: [GENERAL] Question on the use of bracket expressions in Postgres

2005-12-15 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Michael Glaesemann <[EMAIL PROTECTED]> writes: > On Dec 15, 2005, at 0:29 , Jimmy Rowe wrote: >> select * from catalog where file_name like 'abc%def%.200[2-5]%'; >> The following select keeps returning "(0 rows)". > LIKE doesn't consider [2-5] to be a range, but r

Re: [GENERAL] newbie design question re impact of VACUUM

2005-11-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > As a background, I'll be using Postgres in part as a processing queue > for a 40-column stream of information (~ 250 bytes/row) with a > sustained input rate of 20 rows/sec. This queue will be processed > periodicall

Re: [GENERAL] Disappearing Records

2005-11-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Douglas McNaught <[EMAIL PROTECTED]> writes: > Rory Browne <[EMAIL PROTECTED]> writes: >> select u.username, g.groupname from users u, groups g where u.group_id=g.id >> (assuming users are in exactly one group) >> >> If the group_id field in the users table was cor

Re: [GENERAL] a stored procedure ..with integer as the parameter

2005-10-25 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alex Turner <[EMAIL PROTECTED]> writes: > delete * from user; > select * from table where my_id=$in_value > Am > I just smoking crack here, or does this approach have some merit? > The former :-) The correct defense against SQL injection is prope

Re: [GENERAL] a stored procedure ..with integer as the parameter

2005-10-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Alex Turner <[EMAIL PROTECTED]> writes: > 1. ( ) text/plain (*) text/html > As sort of a side discussion - I have postulated that quoting all incomming > numbers as string would be an effective defense against SQL Injection style > attacks, as m

Re: [GENERAL] Get postgresql workin in french...

2005-08-31 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Guy Doune <[EMAIL PROTECTED]> writes: > Hi, > I would know how to set the encoding (unicode, ASCII, > etc.) for getting postgresql accepting my entry with > accent an all the what the french poeple put over > there caracter while they write... French is covered bot

Re: [GENERAL] Missing numbers

2005-06-01 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Simon Riggs <[EMAIL PROTECTED]> writes: > If the WHERE clause said bdocs.doc_numero > 7 we would hope that this > was applied before the join. Stating this would change the OUTER into an INNER JOIN, and this would imply that the order of the restrictions is irrelev

Re: [GENERAL] Missing numbers

2005-05-31 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, josue <[EMAIL PROTECTED]> writes: > Hello list, > I need to track down the missing check numbers in a serie, table > contains a column for check numbers and series like this: > dbalm=# select doc_numero,doc_ckseriesfk from bdocs where doc_cta=1 > dbalm-# and doc_t

  1   2   >