Re: [GENERAL] Selective backup script

2011-11-21 Thread Michael Glaesemann
On Nov 21, 2011, at 11:50, Mike Blackwell wrote: > Might there be a way to > tag those databases somehow so the backup script knows to skip them? Add a table to each database that can be queried by the back up script to store this additional metadata? Michael Glaesemann grzm seespotco

Re: [GENERAL] Performance degradation 8.4 -> 9.1

2011-11-17 Thread Michael Glaesemann
d, ml.jobid) AND e1.type = 1 WHERE jobid = 1132730; Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Saving score of 3 players into a table

2011-10-27 Thread Michael Glaesemann
On Oct 27, 2011, at 7:21, Alexander Farber wrote: > Thank you Michal and others - > > On Wed, Oct 26, 2011 at 11:11 PM, Michael Glaesemann > wrote: >> Get games for a particular user: >> >> SELECT g.gid, g.rounds, g.finished >> FROM pref_games g >>

Re: [GENERAL] Saving score of 3 players into a table

2011-10-26 Thread Michael Glaesemann
for a particular user: SELECT g.gid, g.rounds, g.finished FROM pref_games g JOIN pref_scores u USING (gid) WHERE u.id = :id; Now, add the participants for those games SELECT g.gid, g.rounds, g.finished, p.id, p.money, p.quit FROM pref_games g JOIN pref_scores u USING (g

Re: [GENERAL] Saving score of 3 players into a table

2011-10-25 Thread Michael Glaesemann
g else about your application, I suspect you need more tables: a games table a games_players table with each row associating a single player with a game. A three-player game has three rows per game. A four-player game would have four. Depending on your app, you might also have finished_g

Re: [GENERAL] function "XXX" already exists with same argument types

2011-10-05 Thread Michael Glaesemann
h same argument types > ALTER FUNCTION > > The 1st waring is ok, as I've run "create language plpgsql" before. > > But why do I get the function warings? Likely someone mistakenly added the functions to template1 of the machine you're restoring onto and they're getting added to the new database when it's created. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] tubles matching

2011-09-28 Thread Michael Glaesemann
paring all the column > values. I want to write a pgplsql function to do this Job by iterating > through all the coloumns and compare the values. > > Is there another way to do that ? SELECT * FROM a NATURAL JOIN b; Michael Glaesemann grzm seespotcode net -- Sent via pgsql-ge

Re: [GENERAL] Quick Date/Time Index Question

2011-09-22 Thread Michael Glaesemann
inition, order on date as well? Another option is to use some other operator rather than =, if you're selecting items, such as BETWEEN or >= and <, such as WHERE field >= date0 AND field < date0 + 1 This would use an index on the timestamp column. Michael Glaesemann

Re: [GENERAL] Book

2011-07-20 Thread Michael Glaesemann
On Jul 20, 2011, at 18:11, Andrej wrote: > Can anyone recommend "PostgreSQL 9.0 High Performance" by G. Smith? Yes. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] pipe text to copy statement stdin input

2011-06-21 Thread Michael Glaesemann
ql` as a non-interactive > command may not be possible. Right? Use a .pgpass file Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Michael Glaesemann
On May 21, 2011, at 13:44, Pavel Stehule wrote: > 2011/5/21 Michael Glaesemann : >> >> It looks like it's just column names stomping on variable names, which is a >> known issue. This is why a lot of developers (including myself) have >> conventions of prefixi

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Michael Glaesemann
4 5 6 (6 rows) It looks like it's just column names stomping on variable names, which is a known issue. This is why a lot of developers (including myself) have conventions of prefixing parameters and variable names (I use in_ for input parameters, v_ for internally defined variables). Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] length of return value of to_char()

2011-05-20 Thread Michael Glaesemann
iteral --- ' 0011' (1 row) Compare using Fill Mode (FM): postgres=# SELECT quote_literal(to_char(11, 'FM0999')); quote_literal --- '0011' (1 row) See the documentation for more details: <http://www.postgresql.org/docs/9.0/interactive/funct

Re: [GENERAL] PostgreSQL Core Team

2011-04-27 Thread Michael Glaesemann
On Apr 27, 2011, at 14:48, Dave Page wrote: > I'm pleased to announce that effective immediately, Magnus Hagander > will be joining the PostgreSQL Core Team. Congratulations, Magnus! Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pg

Re: [GENERAL] adding years to a date field

2011-04-06 Thread Michael Glaesemann
some string. select (current_timestamp at time zone 'utc' + CAST(3 AS SMALLINT) * interval '1 year'); ?column? 2014-04-06 16:27:30.273562 (1 row) Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing lis

Re: [GENERAL] forums.postgresql.com.au

2011-04-06 Thread Michael Glaesemann
es the lists less useful. Frankly, when I frequented the Ruby mailing lists, I ended up purposely filtering out the posts coming from the forum. I found the forum postings to be of much lower quality than the ones coming through the mailing list. Granted, this is anecdotal, and based on my own per

Re: [GENERAL] Copying data from one table to another - how to specify fields?

2011-03-09 Thread Michael Glaesemann
er_regdate, user_lastvisit FROM phpbb_users WHERE user_id > 50; <http://www.postgresql.org/docs/9.0/interactive/sql-insert.html> Michael Glaesemann michael.glaesem...@myyearbook.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Data types for IP address.

2011-02-23 Thread Michael Glaesemann
>> 1.2.3.0/24 > > yes, but what about 10.1.2.57-10.1.2.123 ?presumably valid in his range > system, and certainly NOT a valid CIDR range. If it hasn't been mentioned already, take a look at ip4r. <http://pgfoundry.org/projects/ip4r/> Michael Glaesemann grz

Re: [GENERAL] Speeding up index scans by truncating timestamp?

2011-02-15 Thread Michael Glaesemann
le of using the relationship between an index on > date_trunc(foo) and a query with "where foo < bar and foo > baz" ? At this > point the question is to satisfy my own curiosity. Providing the table definition, queries, and EXPLAIN and EXPLAIN ANALYZE output would h

Re: [GENERAL] excessive escaping in regular expression functions

2011-01-18 Thread Michael Glaesemann
On Jan 18, 2011, at 14:52, A.M. wrote: > Is there a better way? Use dollar quotes or standard quoting instead of E strings. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: h

Re: [GENERAL] [pgsql-www] Forums at postgresql.com.au

2010-11-20 Thread Michael Glaesemann
to All: Cmd-Shift-R. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Removing pgsql_tmp files

2010-11-08 Thread Michael Glaesemann
On Nov 8, 2010, at 16:03 , Tom Lane wrote: > Michael Glaesemann writes: >> We've got over 250GB of files in a pgsql_tmp directory, some with >> modification timestamps going back to August 2010 when the server was last >> restarted. > > That's very p

[GENERAL] Removing pgsql_tmp files

2010-11-08 Thread Michael Glaesemann
files from the file system? Why might these files not be cleaned up on their own? Cheers, Michael Glaesemann michael.glaesem...@myyearbook.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] unique constraint

2010-10-20 Thread Michael Glaesemann
of positions. Negative numbers are often used for this middle range. This is basically a hierarchy problem. Take a gander around the web for nested sets for examples. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make cha

Re: [GENERAL] Deleting orphaned records (not exists is very slow)

2010-09-27 Thread Michael Glaesemann
ot it sussed out. Good luck with straightening out the rest of your data! Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Deleting orphaned records (not exists is very slow)

2010-09-27 Thread Michael Glaesemann
On Sep 27, 2010, at 22:08 , Tim Uckun wrote: > update to_be_deleted set mark = true where ctid = any (array( select > ctid from to_be_deleted limit 10)); Why are you messing with ctid? Does the table have no key? If not, you should fix that first. Michael Glaesemann grzm seespotco

Re: [GENERAL] Deleting orphaned records (not exists is very slow)

2010-09-27 Thread Michael Glaesemann
wish, using orphaned_bar. You might want to do them in one go, or in batches. You'll likely want to create an index on orphaned_bar.keycol. You can then add your foreign key and get rid of the trigger on foo when you're done. Hope this helps. Michael Glaesemann grzm seespotcode

Re: [GENERAL] Alter Table Command Rearranges Rows

2010-09-17 Thread Michael Glaesemann
T name = 'David' WHERE id = '1'; > UPDATE 1 This isn't valid syntax: I believe you issued UPDATE users Postgres (nor any other SQL RDBMS) does not guarantee row order unless you specify it with an ORDER BY clause. Michael Glaesemann grzm seespotcode net

Re: [GENERAL] Int to Interval conversion

2010-09-14 Thread Michael Glaesemann
----- 24:00:00 (1 row) Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread Michael Glaesemann
elease by applying a single patch is insane. Not only that, but the to upgrade to 8.1.21 would require less work (and the same downtime) as to apply the patch. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Why No WHERE clause for INSERT statements

2010-08-17 Thread Michael Glaesemann
able [ ( column [, ...] ) ] SELECT ... WHERE condition > This syntax would allow tuples to be inserted only when some condition is > true. > What I am missing? See above. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql

Re: [GENERAL] pg_dump and boolean format

2010-08-11 Thread Michael Glaesemann
On Aug 11, 2010, at 18:21 , Scott Frankel wrote: > > On Aug 11, 2010, at 10:12 AM, Michael Glaesemann wrote: > >> One option is to use COPY to export the data in a format you like. For >> example: COPY (SELECT CAST(boolean_column AS INT) FROM my_table) TO STDOUT. >>

Re: [GENERAL] pg_dump and boolean format

2010-08-11 Thread Michael Glaesemann
1. One option is to use COPY to export the data in a format you like. For example: COPY (SELECT CAST(boolean_column AS INT) FROM my_table) TO STDOUT. Then write a script which reads the exported data files and loads them into your sqlite database. COPY WITH CSV would likely be helpful as well.

Re: [GENERAL] Can't EXTRACT number of months from an INTERVAL

2010-06-30 Thread Michael Glaesemann
that each month has 30 days: =# select cast(extract('days' from timestamp '2010-06-26 00:00:00' - timestamp '2008-11-07 00:00:00') as int) / 30; ?column? -- 19 (1 row) And you're dealing only with dates): =# select (cast('2010-06-26

Re: [GENERAL] Grant column level permissions

2010-04-08 Thread Michael Glaesemann
column level > permissions? Basically, I want to give permissions to set of > users(user-group) to only couple of columns in my table. Have you reviewed the fine documentation? <http://www.postgresql.org/docs/8.4/interactive/sql-grant.html> Michael Glaesemann grzm seespotcode net --

Re: [GENERAL] How to add month.year column validation

2009-12-22 Thread Michael Glaesemann
pplication are using it. I cannot change column type to date since other applications are expecting char(7) column. Just so you know, down this road lies madness. I completely agree. Schedule some downtime and make the column a date column. Michael Glaesemann grzm seespotcode net -- Se

Re: [GENERAL] How to add month.year column validation

2009-12-22 Thread Michael Glaesemann
is always 1 or some other agreed-upon (and documented) value (e.g., CHECK (val = date_truc('month', val))). If the data is date data, you're likely going to want to do other operations on the field which will be much easier if it's already a date value. Michael Glaesem

Re: [GENERAL] I need a Postgres Admin $130K + 20K in NYC Any Ideas?

2009-09-15 Thread Michael Glaesemann
lling meals at restaurants in Manhattan for much less that $30. Michael Glaesemann grzm seespotcode net [1]<http://www.nyc.gov/html/tlc/html/passenger/taxicab_rate.shtml> -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscri

Re: [GENERAL] array weirdity

2009-09-03 Thread Michael Glaesemann
T (1229 = ANY('{1220,0,0,1228,1229,1231,0,0,0}'::int[])) as result; result f (1 row) Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Keys and indexes

2009-09-01 Thread Michael Glaesemann
On Sep 1, 2009, at 7:37 , Alexandr Varlamov wrote: Does indexing working for foreignkeys column automaticaly? No. Or i need create index manually. Yes. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] Postgre RAISE NOTICE and PHP

2009-08-19 Thread Michael Glaesemann
equivalent in PDO? Looking through the docs I don't see one. It'd also be nice to be able to get at any/all of the additional information that's passed back: warning, context, hint, etc. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general

Re: [GENERAL] Empty Updates, ON UPDATE triggers and Rules

2009-08-06 Thread Michael Glaesemann
<> operator doesn't exist for the test_upd rowtype. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] integration of fulltext search in bytea/docs

2009-07-30 Thread Michael Glaesemann
On Jul 30, 2009, at 9:09 , Radek Novotný wrote: Is there possible to create pg trigger that runs shell script? [Please don't top post.] Yes. You can use an untrusted language such as pl/perlu to run system commands. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-ge

Re: [GENERAL] Relational Algebra and Aggregate Functions

2009-07-28 Thread Michael Glaesemann
hough he's effectively rewritten it as "SQL and Relational Theory: How to Write Accurate SQL Code" http://www.amazon.com/SQL-Relational-Theory-Write-Accurate/dp/0596523068 Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@po

Re: [GENERAL] Upgrading from 8.3 to 8.4 and Integer datatimes?

2009-07-28 Thread Michael Glaesemann
pg_dump is independent of the binary format: timestamps (and other values) are literal representations. As always, for your own edification and assurance, I'd test this with both a small, toy database and with your production database before your final upgrade. Michael Glaesemann

Re: [GENERAL] Calculating the difference between timetz values

2009-07-27 Thread Michael Glaesemann
On Jul 27, 2009, at 10:54 , Alexey Klyukin wrote: Hello, I was looking for a way to get the difference (interval) between 2 timetz values, i.e.: I don't have a solution, but am curious what your use case is for timetz (as opposed to timestamptz). Michael Glaesemann grzm seespo

Re: [GENERAL] Benetl, a free ETL tool for files using postgreSQL, is out in version 2.9

2009-07-13 Thread Michael Glaesemann
postgresql.org/mailpref/pgsql-general Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] accessing anyarray elements

2009-06-12 Thread Michael Glaesemann
lower_bound := upper_bound; upper_bound := in_histogram_bounds[v_idx]; CONTINUE WHEN v_idx = 1; bucket_index := bucket_index + 1; width := upper_bound - lower_bound; cumulative_width := cumulative_width + width; RETURN NEXT; END LOOP; RETURN; END $body$; Any ideas on how I mi

Re: [GENERAL] i have a problem with judge some words contain chinese word!

2009-03-30 Thread Michael Glaesemann
some_text | length | re | length | str_eq | len_eq -++-+++ foo | 3 | foo | 3 | t | t foo bar baz | 11 | foo bar baz | 11 | t | t foo.bar,baz | 11 | foo.bar,baz | 11 | t | t foo案 | 4

Re: [GENERAL] Using null or not null in function arguments

2009-01-23 Thread Michael Glaesemann
e) ~ upper(i_lastname)) LIMIT $5 OFFSET $6 $$; Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Annoying Reply-To

2008-10-17 Thread Michael Glaesemann
t. You should consider switching to something that has a reply-to button. I'm very disappointed in Apple. It's not. It has Reply and Reply All buttons for the clicky-clicky folk, and keyboard shortcuts for each as well. Michael Glaesemann grzm seespotcode net -- Sent via pgsql-g

Re: [GENERAL] grabbing date of last Sunday?

2008-10-10 Thread Michael Glaesemann
008-10-05 | 2008-10-05 | 2008-10-05 (1 row) Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] How do I specify intervals in functions?

2008-07-31 Thread Michael Glaesemann
PostgreSQL 8.2.5 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.2) (1 row) I can't tell as you haven't provided a complete example (always helpful when debugging), but are you sure you're specifying the correct language type (plpgsql in your

Re: [GENERAL] unable to drop a constraint

2008-07-16 Thread Michael Glaesemann
ERROR: "customer_pkey" is an index Are you using slony perchance? This looks like an issue with slony blocking DDL operations: http://lists.slony.info/pipermail/slony1-general/2006-November/005216.html Michael Glaesemann [EMAIL PROTECTED] -- Sent via pgsql-general mailing list

Re: [GENERAL] functions, transactions, key violations

2008-06-04 Thread Michael Glaesemann
a); COMMIT; I'm obviously on the cusp of learning something new, or understanding concurrency more deeply, so I'm looking forward to your responses. Cheers, Michael Glaesemann grzm seespotcode net -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] functions, transactions, key violations

2008-06-04 Thread Michael Glaesemann
ND; END LOOP; END $$ LANGUAGE plpgsql; Michael Glaesemann grzm seespotcode net CREATE TABLE purchases ( purchase_id SERIAL PRIMARY KEY, item_id INT NOT NULL, purchased_by int NOT NULL, purchase_price INT NOT NULL, purchased_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, purch

[GENERAL] functions, transactions, key violations

2008-06-04 Thread Michael Glaesemann
n't affect any rows, I'd expect the transaction to be successful. What am I missing? Thanks for your help. Michael Glaesemann grzm seespotcode net [1](http://www.postgresql.org/docs/8.3/interactive/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE ) -- Sent via pgsql-general m

Re: [GENERAL] syntax errors at "line 1" when executing every command

2008-02-28 Thread Michael Glaesemann
INE 1: createdb; createdb is a command line application. You're looking for the CREATE DATABASE SQL command: http://www.postgresql.org/docs/8.3/interactive/sql-createdatabase.html Michael Glaesemann [EMAIL PROTECTED] ---(end of broadcast)--- TIP

Re: [GENERAL] UUID-OSSP for windows.

2008-02-28 Thread Michael Glaesemann
On Feb 27, 2008, at 16:59 , Tim Uckun wrote: citext is not part of core PostgreSQL or something we have any intention to include in the Windows distribution at this time. Is there an alternative for people wanting a case insensitive collation? ORDER BY lower(foo) ? Michael Glaesemann

Re: [GENERAL] Question about the enum type

2008-02-17 Thread Michael Glaesemann
On Feb 17, 2008, at 21:24 , Tim Hart wrote: But for my own education - what's so unique about the name 'position'? It's an SQL keyword: http://www.postgresql.org/docs/8.3/interactive/sql-keywords- appendix.html Michael Glaesemann grzm seespotcode net --

Re: [GENERAL] Timestamp indexes (why ">" or "between" does not use index?)

2008-02-16 Thread Michael Glaesemann
EXPLAIN ANALYZE with seq scans disabled? Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org/

Re: [GENERAL] Strict-typing benefits/costs

2008-02-16 Thread Michael Glaesemann
e, we're comparing against a date type, so Postgres treats '2008-02-15' as a date. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] [OT] Slony + Alter table using pgadmin

2008-01-30 Thread Michael Glaesemann
word `help' in the subject or body (don't include the quotes), and you will get back a message with instructions. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please

Re: [GENERAL] Read/Write restriction mechanism

2008-01-09 Thread Michael Glaesemann
, not the connections). Um, why are DB-level permissions out? It seems like a natural fit: your writer connects as one role while the readers connect as another. Only grant SELECT access to the readers. Michael Glaesemann grzm seespotcode net ---(end of broa

Re: [GENERAL] How to handle 'not a number' in postgresql

2008-01-04 Thread Michael Glaesemann
could be a useful value to distinguish between truly unknown quantities (say, that particular machine was not taking measurements during a particular test) and those where you've received a value from a machine and it's NaN. But I agree, it does depend on the application. Michael

Re: [GENERAL] How to handle 'not a number' in postgresql

2008-01-04 Thread Michael Glaesemann
mmon sense prevails* Michael Glaesemann [EMAIL PROTECTED] ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to t

Re: [GENERAL] How to insert on duplicate key?

2007-12-24 Thread Michael Glaesemann
On Dec 24, 2007, at 22:03 , [EMAIL PROTECTED] wrote: I have googled and currently the only way I can find is do query first and then update or insert. Or alternatively, UPDATE and see if you've affected any rows. If not, insert. Michael Glaesemann grzm seespotcod

Re: [GENERAL] Postgres from PHP in Leopard

2007-12-24 Thread Michael Glaesemann
being overwritten. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] self ordering list

2007-12-22 Thread Michael Glaesemann
E priority >= 2; INSERT INTO tablename (priority, workitem) VALUES (2, 'new task'); UPDATE tablename SET priority = ABS(priority) WHERE priority < 0; $func$; This is in the same vein as methods to maintain nested set-encoded hierarchies, which are also order-depen

Re: [GENERAL] Requirements for Constraint Trigger's Function

2007-12-22 Thread Michael Glaesemann
On Dec 21, 2007, at 13:12 , Richard Broersma Jr wrote: What is the proper way for the function of a constraint trigger to signal where or not referential integrity was compromised? Should it return some sort of value? Should it raise an exception? The latter. Michael Glaesemann grzm

Re: [GENERAL] insert into...

2007-12-09 Thread Michael Glaesemann
On Dec 9, 2007, at 11:05 , Alain Roger wrote: Hi, i would like to understand why the following INSERT INTO statement works : INSERT INTO mytable SELECT nextval('my_sequence'), 'myname', 'myfirstname' ; whereas usually we should do : INSERT INTO mytable VALUES ( SELECT nextval

Re: [GENERAL] storage size of "bit" data type..

2007-12-05 Thread Michael Glaesemann
1') as "17bits", pg_column_size(B'') as "3bytes"; 1bit | 4bits | 1byte | 12bits | 2bytes | 17bits | 3bytes --+---+---++++ 9 | 9 | 9 | 10 | 10 | 11 | 11 (1 r

Re: [GENERAL] Primary Key

2007-11-23 Thread Michael Glaesemann
r a key in the logical sense. Uniqueness is implemented in terms of btree indexes in PostgreSQL. It seems to me you're conflating logical (key) and physical (index) concepts here. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--

Re: [GENERAL] Composite types for composite primary/foreign keys?

2007-11-19 Thread Michael Glaesemann
of simplifying you find a solution yourself. However, we cannot help you if you don't provide adequate information. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Qeury a boolean column?(using postgresql & EJB)

2007-11-17 Thread Michael Glaesemann
only thing i can do to maximized my time thanks... I strongly suspect you're not showing us the entire query you're using because this should work. If you want to figure out what's wrong, please provide a self-contained example which displays the behavior you're seeing.

Re: [GENERAL] pg_dump not including custom CAST?

2007-11-17 Thread Michael Glaesemann
ump and restore? pg_dump thinks it's a built-in system object. What other objects might be susceptible to this? Operators? Operator classes? Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Composite types for composite primary/foreign keys?

2007-11-17 Thread Michael Glaesemann
column as a primary / foreign key or whether not...? What have you actually tried? You can learn a lot by a few minutes of exploration at a psql prompt. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] "and then" / "or else"

2007-11-17 Thread Michael Glaesemann
- second branch (1 row) test=# select test_case_in_if(false, true, false); test_case_in_if - first branch (1 row) Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Qeury a boolean column?(using postgresql & EJB)

2007-11-16 Thread Michael Glaesemann
query is returning all of the rows of the table. Either sample doesn't contain any rows where letsaythisisboolean is true or you just haven't looked through all of them yet. Michael Glaesemann grzm seespotcode net ---(end of broadcast)---

Re: [GENERAL] Regression in 8.3?

2007-11-11 Thread Michael Glaesemann
is working as intended. If you want to treat a bigint or a date as a string, explicitly cast it. Michael Glaesemann grzm seespotcode net PGP.sig Description: This is a digitally signed message part

Re: [GENERAL] Stored procedure for generation next sequence value

2007-10-29 Thread Michael Glaesemann
On Oct 29, 2007, at 18:59 , Frank Church wrote: Is there a built in function for retrieving the next value of a sequence and updating the sequence counter? http://www.postgresql.org/docs/faqs.FAQ.html#item4.11.2 http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html Michael

Re: [GENERAL] createdb argument question

2007-10-27 Thread Michael Glaesemann
On Oct 27, 2007, at 12:56 , Perry Smith wrote: On my Mac systems, this work. On my AIX system it does not. I get: Versions? Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will

Re: [GENERAL] find out data types using sql or php

2007-10-26 Thread Michael Glaesemann
if names in an imported file were properly split along given and family name lines. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Selecting tree data

2007-10-26 Thread Michael Glaesemann
a I need and then building the tree structure in my app code. Part of the issue is how do you *store* the tree in the database. You have to encode that information somehow. These are all methods to do that. Michael Glaesemann grzm seespotcode net --

Re: [GENERAL] How to ALTER a TABLE to change the primary key?

2007-10-26 Thread Michael Glaesemann
ll Indexes: "new_pkey" PRIMARY KEY, btree (a_string) Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Selecting tree data

2007-10-26 Thread Michael Glaesemann
r nested set (or even nested intervals). Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] uniquely indexing Celko's nested set model

2007-10-20 Thread Michael Glaesemann
m time to time as inserts fill in the gaps. You could also do nested sets using numeric rather than integer, which gives you a lot more flexibility. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 3: Have you

Re: [GENERAL] uniquely indexing Celko's nested set model

2007-10-20 Thread Michael Glaesemann
f thrashing as everything above and to the left of the update must be updated as well. AFAIK, there isn't currently a single best solution for representing trees in SQL. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] uniquely indexing Celko's nested set model

2007-10-19 Thread Michael Glaesemann
s thoroughly, you can be pretty sure that your table updates aren't going to cause any duplication of this time. Then again, maybe I should add the trigger to be on the safe side :) Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Questions about LIMIT/OFFSET

2007-10-19 Thread Michael Glaesemann
inal step at least) and less data transmitted between the server and your application. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Problem of installation on Mac

2007-10-19 Thread Michael Glaesemann
On Oct 19, 2007, at 13:50 , brian wrote: Michael Glaesemann wrote: On Oct 20, 2000, at 13:05 , Martin Gainty wrote: Martin, it continues to amaze me how you're able to predict and contribute to the discussion 7 years in advance! Michael Glaesemann grzm seespotcode net But tem

Re: [GENERAL] Problem of installation on Mac

2007-10-19 Thread Michael Glaesemann
On Oct 20, 2000, at 13:05 , Martin Gainty wrote: Martin, it continues to amaze me how you're able to predict and contribute to the discussion 7 years in advance! Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP

Re: [GENERAL] problem with a column of type timestamp

2007-10-16 Thread Michael Glaesemann
t the time zone: I believe it's that one is a *timestamp* while the other is a *time*; Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-16 Thread Michael Glaesemann
em in another table: they're not the type of data as the rest. If you do, include the year just like normal and modify the query so it's not joining on the year. If you need to include both with years and without, write your query appropriately to include rows from both ta

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread Michael Glaesemann
27;m aware of is Snodgrass' "Developing Time-Oriented Database Applications in SQL"[1]. Date, Darwen, and Lorentzos' "Temporal Data and the Relational Model"[2] is a more general text on the same topic, but isn't directly applicable to ANSI SQL. I sugges

Re: [GENERAL] Foreign Key for PHP serialized data - possible?

2007-10-08 Thread Michael Glaesemann
t the serialization issue you're having above. I recommend changing your schema. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if yo

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-05 Thread Michael Glaesemann
e due to the response you got to an off-topic post. Many of the people on the lists have been here for years and have gotten lots of helpful advice, which is why they've stuck around, and are many others that are happy to share their advice and experience. You never know: you might be

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-05 Thread Michael Glaesemann
;s not a problem for me — and I don't believe my emails include X-Message-Flag headers so I'm not contributing to your problem — hope you find a solution that works for you. Michael Glaesemann grzm seespotcode net ---(end of broadcast)---

Re: [GENERAL] Request: Anyone using bogus / "humorous" X-Message-Flag headers, could we please turn them off

2007-10-05 Thread Michael Glaesemann
ution would be to find (or develop) tools that do what you want. Whether that means better rule handling or better understanding of various headers, it sounds like Outlook isn't doing the job for you. Perhaps a hybrid approach would be helpful: use another email client for mailing lists an

Re: [GENERAL] Find min year and min value

2007-10-05 Thread Michael Glaesemann
ect id_country, year, internet_users.value as internet_users, gdp.value as gdp from internet_users join gdp using (id_country, year) where id_country = 8 order by year limit 1 Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP 9: In ver

  1   2   3   4   5   6   >