Re: [SQL]

2013-10-08 Thread Plugge, Joe R.
1 - why two databases? Couldn't you have just created two separate SCHEMAS? 2 - if you insist on two separate databases: http://www.postgresql.org/docs/9.2/static/dblink.html From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Kaleeswaran Velu Sent: Tues

Re: [SQL] generic crosstab ?

2012-04-24 Thread Joe Conway
o idea. The error is because you are selecting from a set returning function in the target list rather than the from clause. It should be more like: SELECT * FROM crosstab(text, text) AS ( col1_name col1_type [, colN_name > colN_type]* ) HTH, Joe -- Joe Conway credativ LLC: http://www.creda

Re: [SQL] When To Use Quotes

2012-01-05 Thread Plugge, Joe R.
Should match to the data type of the filtered value, so CHAR,VARCHAR,All DATE TYPES should be quoted. INTEGER, BIGINT, SMALLINT should not -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Carlos Mennens Sent: Thursday, Jan

Re: [SQL] Compare two Data bases Structure

2011-02-23 Thread Plugge, Joe R.
Check out DB Solo ... http://www.dbsolo.com/ Does both DDL compare as well as data compare. From: pgsql-sql-ow...@postgresql.org [pgsql-sql-ow...@postgresql.org] On Behalf Of manuel antonio ochoa [manuel8aalf...@gmail.com] Sent: Wednesday, February 23, 2011 6:

[SQL] Correct usage of FOR UPDATE?

2010-12-11 Thread Joe Carr
Hello, I have a simple table-based queue system, and I'd looking for some advice on improving my dequeue function. it boils down to: SELECT id FROM queue WHERE FOR UPDATE NOWAIT; which works well, in that no item gets dequeued more that once. The issue, however is that when a contention occurs,

Re: [SQL] Union Question

2010-12-03 Thread Plugge, Joe R.
You may want to try dblink. http://www.postgresql.org/docs/current/static/dblink.html From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Shaun McCloud Sent: Friday, December 03, 2010 10:51 AM To: pgsql-sql@postgresql.org Subject: [SQL] Union Question Hell

Re: [SQL] Generating Rows from a date and a duration

2010-09-08 Thread Joe Conway
010-09-03 2 | 2010-09-04 2 | 2010-09-05 2 | 2010-09-06 2 | 2010-09-07 2 | 2010-09-08 (10 rows) HTH, Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & 24x7 Support signature.asc Description: OpenPGP digital signature

Re: [SQL] strangest thing happened

2010-07-07 Thread Joe Conway
rec.table_name; EXECUTE sql INTO startval; IF startval IS NOT NULL THEN sql := 'ALTER SEQUENCE ' || seqname || ' RESTART WITH ' || startval; EXECUTE sql; RAISE NOTICE '%', sql;

Re: [SQL] how to construct sql

2010-06-02 Thread Plugge, Joe R.
This is discussed in this Wiki: http://wiki.postgresql.org/wiki/Grouping_Sets -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Hiltibidal, Rob Sent: Wednesday, June 02, 2010 12:06 PM To: Oliveiros; Wes James; pgsql-sql@postgr

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
ownerid = OLD.ownerid; RETURN NEW; END IF; RETURN NULL; -- result is ignored since this is an AFTER trigger END; $$; Thanks !! From: Justin Graf [mailto:jus...@magwerks.com] Sent: Thursday, May 06, 2010 3:59 PM To: Plugge, Joe R.; pgsql-sql@postgresql.org Subject

Re: [SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
Nevermind all, I figured it out Thanks Dmitriy ... From: Dmitriy Igrishin [mailto:dmit...@gmail.com] Sent: Thursday, May 06, 2010 3:25 PM To: Plugge, Joe R. Subject: Re: [SQL] Column Specific Update Trigger Routine Hey Plugge, You dont need to pass OLD.* or NEW.* to the trigger function

[SQL] Column Specific Update Trigger Routine

2010-05-06 Thread Plugge, Joe R.
I am trying to create a update trigger on a table that basically will only fire when a specific column is updated. I am using version 8.4.3. My plan of attack was to always fire on any row update, and pass in the OLD and NEW column that I want to check. CREATE TRIGGER check_lockout AFTER U

Re: [SQL] understanding select into

2010-04-09 Thread Plugge, Joe R.
Johnf, I would think that the _p, _test, _r etc are local variables within the procedure/function and this is the way that the value (from the select) gets assigned to that local variable. -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.or

Re: [SQL] Simple aggregate query brain fart

2010-03-18 Thread Plugge, Joe R.
Mark, Change your query to this: SELECT id, count(*) FROM mytable GROUP BY id HAVING count(*) > 2; -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Mark Fenbers Sent: Thursday, March 18, 2010 10:07 AM To: pgsql-sql@postgresql

Re: [SQL] PostgreSQL Active-Active Configuration

2010-03-05 Thread Plugge, Joe R.
You may want to try Bucardo ... By performance, are you referring to latency? If so, bandwidth between sites typically is the factor with latency in any replication solution. http://bucardo.org/ -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgres

Re: [SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
7;1 minute'; newstop := newstop + INTERVAL '1 minute'; END LOOP; END; $$ LANGUAGE 'plpgsql' VOLATILE; From: epai...@googlemail.com [mailto:epai...@googlemail.com] On Behalf Of Brian Modra Sent: Friday, October 30, 2009 2:46 PM To: Plugge, Joe R. Cc: pgsql-sql@

Re: [SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
il.com] On Behalf Of Brian Modra Sent: Friday, October 30, 2009 2:29 PM To: Plugge, Joe R. Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Function Syntax Help 2009/10/30 Plugge, Joe R. mailto:jrplu...@west.com>> I am trying to create a function that will grind through a cdr table and p

[SQL] Function Syntax Help

2009-10-30 Thread Plugge, Joe R.
ount); mystart := mystart + INTERVAL '1 minute'; mystop := mystop + INTERVAL '1 minute'; END LOOP; END; $$ LANGUAGE 'plpgsql' STABLE; [cid:image002.jpg@01CA596B.59B9EC10]Joe R. Plugge Database Administrator, West Interactive Corporation 11650

Re: [SQL] grouping/clustering query

2008-10-23 Thread Joe
ce transaction 1 was applied to both invoices A and B, you need to group the invoices so that you can compare total invoiced against total paid. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] ORDER BY collation order

2008-09-21 Thread Joe
a -- Abc 123 "quoted" (3 rows) Those operators give me "C"-style collation in the database that is using "en_US" collation, but what I would really prefer is the reverse. BTW, where are those operators documented? Neither Google nor Yahoo nor postgresql.org s

Re: [SQL] ORDER BY collation order

2008-09-18 Thread Joe
27;s even trickier than this simple example, because on Debian which is using the en_US locale, the double quotes are disregarded for ordering purposes, e.g., Medical "Meet" Message Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

[SQL] ORDER BY collation order

2008-09-18 Thread Joe
ter since it's shared with others at our hosting provider. Is there some way to override the cluster setting, or plans to allow for database-specific collation orders? Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresq

Re: [SQL] Cursor

2008-08-16 Thread Joe
loop, you can check sqlca.sqlcode for 100 (NOT FOUND) or a SQLSTATE of 02000. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] bcp.exe Fix Triggers

2008-06-02 Thread Joe
Use an underscore (_) instead of a minus (-), i.e., $bcp_fix$. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Protection from SQL injection

2008-04-27 Thread Joe
t support prepared statements. I assume you didn't check the PEP 249 (http://www.python.org/dev/peps/pep-0249/). The execute() and executemany() Cursor object methods are precisely to prepare and execute database operations. Joe -- Sent via pgsql-sql mailing list (pgsql-sq

Re: [SQL] Protection from SQL injection

2008-04-27 Thread Joe
xample using the pyformat style: http://www.devx.com/opensource/Article/29071/0/page/3. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Select into

2008-03-20 Thread Joe
nd above. I don't see why my query would fail in subsequent releases. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Select into

2008-03-20 Thread Joe
col1 = 3; will result in: col1 | col2 | col3 --+--+--- 1 | 789 | third record 2 | 456 | second record 3 | 789 | third record So, it is a join ... of a table with a virtual copy of itself. Joe -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

Re: [SQL] UTF8 encoding and non-text data types

2008-01-14 Thread Joe
hat it's application specific. The HTML/Perl script ought to convert to Western numerals. Joe ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] UTF8 encoding and non-text data types

2008-01-14 Thread Joe
did happen, code points 1777 and nearby are not digits; they're something or other in Arabic, apparently. Precisely. 1777 through 1780 decimal equate to code points U+06F1 through U+06F4, which correspond to the Arabic numerals 1 through 4. Joe ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Argentinian timezone change at the last moment. How to change pgsql tz db?

2008-01-02 Thread Joe
ocal/share/postgresql/timezone. Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] [GENERAL] Encrypted column

2007-06-05 Thread Joe Conway
nd I'm sure there are HMAC functions available that could be used in PL/Perl and/or PL/Python. Joe ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-05-02 Thread Joe
t you seem to be having a hard time convincing those of us who've taken even a mild interest in TML that it's really needed or is a better solution than what exists today. Joe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-26 Thread Joe
Dmitry, On Thu, 2007-04-26 at 11:33 +0300, Dmitry Turin wrote: > Joe, i speak not about you, but about statistics. Do you actually have statistics of how many people in the general population have learned SQL? And furthermore, how many of those people didn't already know or didn&#

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-25 Thread Joe
agree and converge on those choices. > > 1. Not users, but programmers. > 2. Needs are produced also, as goods and capital goods. > Karl Marks >For example, look at yourself. We are on diametrically opposed sides of that argument, but it's off-to

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-24 Thread Joe
all about. The POSTGRES UCB project had a language called PostQUEL, which may have been technically superior to SQL, but market forces (unfortunately not all "free") pushed Postgres95 and then PostgreSQL to adopt the latter in preference to PostQUEL. Maybe one day we'll ha

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-23 Thread Joe
n a real web application. Show us what TML can do for the users, bboard and classified_ads tables (http://philip.greenspun.com/sql/data-modeling.html), and how it can answer the simple and complex queries in the next two chapters (or as I said, pick a real-life example of your own) and then maybe w

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-20 Thread Joe
yone on this list) will be out of a job and PHP/Perl/etc. will be relegated to the dustbin of programming languages. [Sorry, couldn't resist :-) ] Joe * see http://en.wikipedia.org/wiki/Geico ---(end of broadcast)--- TIP 3: Have you checked

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-20 Thread Joe
n as to how this will be accomplished or ensured that it is correct. Second is how does TML handle relational manipulations such as restriction, projection or aggregation. It appears TML is primarily for joins. Lastly, Dmitry, I think you'll be better off discussing this in comp.databases.theory.

Re: [SQL] A long-running transaction

2007-04-13 Thread Joe
expire, and that test isn't free. Therefore, you do it the same way > any other row gets expired. Just curious: is there a way to defeat MVCC? i.e., if you can lock the database exclusively, there won't be any readers or writers? Joe ---(end of broadcas

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
licit cast, and finally it has to convert back to text for the to_number function. The result of to_number is numeric and you're trying to cast it to bit, which is what the ERROR was telling you can't do. Joe ---(end of broadcast)--- TIP 7:

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
using the bit string operators, as someone pointed out a couple of days ago. In case you haven't looked at them, please see: http://www.postgresql.org/docs/8.2/static/functions-bitstring.html Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
rewrite or cast the expression. As suggested by the error, you should use a cast, e.g., insert into test_a values 9::bit(3); This will result in binary '001' being inserted because you need 4 bits to represent decimal 9. Joe ---(end of broadcast)

Re: [SQL] exception handling in postgres plpgsql

2007-04-03 Thread Joe
tion condition "no_data_found" > CONTEXT: compile of PL/pgSQL function "audio_format_func" near line > 15 The constant is no_data. See http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html Joe ---(end of broadcast)--

Re: [SQL] Dummy question

2007-03-22 Thread Joe
= tb2.id Try select tb1.* from tabel1 as tb1, table2 as tb2 where tb2.id = 2 and tb1.fk_tb2ID = tb2.id; Joe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL

Re: [SQL] Statistics

2007-03-09 Thread Joe
erpriseDB and Pervasive may have some of what you're looking for since they have to measure themselves against the competition. And remember to take any numbers with a large grain of salt, YMMV, etc. Joe ---(end of broadcast)--- TIP 1: if p

Re: [SQL] pg_dump inquiry

2007-03-01 Thread Joe
gt; rules used by psql's \d commands (see Patterns), so multiple tables can > also be selected by writing wildcard characters in the pattern." But note that this is a new feature in 8.2. In 8.1 and earlier, multiple -t switches will only get you the last one specified. Joe

Re: [SQL] Very large IN-clause is slow, but how to rewrite it?

2007-02-25 Thread Joe Conway
.,(N$)) as t(x)) ? It would be interesting to see how that compares performance-wise. Joe ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] how do I to generate a sequence Range or Set of integer constants

2007-02-23 Thread Joe
IntId FROM MyDataTable ORDER BY id; The id_seq is the sequence on your ID column, assuming it has one, or you can replace the (SELECT ... FROM id_seq) by 1000. Joe ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] simple web search

2007-02-23 Thread Joe
show.show_name, > story.title, person.firtname, person.lastname, etc. > > What is the most elegant way to build a single query to match search > words with multiple columns? You may want to take a look at contrib/tsearch2. Joe ---(end of broadcast)---

Re: [SQL] COPY FROM query.

2007-02-11 Thread Joe
hat on Windows you need to use double backslashes, i.e., 'c:\ \autodrs_appraisal_new.txt', although the regular slash may also work, i.e., 'c:/autodrs_appraisal_new.txt'. Joe ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Joe
ecution" may not be that obvious to the "naked eye" but it would be to a boolean logic analyzer. As to whether these query instances represent few or are typical is arguable, and will depend on the type of application, level of knowledge among users, and what k

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Joe
fore cannot transform one expression into another? What about "x = 10 AND x < 5"? Can't it reduce that to FALSE? Joe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscri

Re: [SQL] Open a Transaction

2007-02-08 Thread Joe
, > 41504, > 41505, > 41506, > 41507, > 41508, > 41509, > 41510, > 41511, > 41512, > 41513, > 41514, > 41515, > 41516, > 41517, > 41518, > 41519, > 41520, > 41521, > 41522, > 41523, > 41524, > 41525, > 41526, > 41527, > 41528, R

Re: [SQL] Log, Logs and more Logs

2007-01-31 Thread Joe
Did you look at the setting of redirect_stderr, and the various logging settings just above it? Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Joe
gt; 510/30/2006 > > Now I need a query that will subtract atime of row 1 from row 2, row2 > from row3 and so on... > > Can anyone please help? How about something like this select x.id, x.atime, x.atime - y.atime as diff from yourtable x, yourtable y where x.id + 1 = y.id;

Re: [SQL] Numbers

2006-11-24 Thread Joe
nd remember to take any numbers with a large grain of salt, YMMV, etc. Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate

Re: [SQL] Question about time

2006-11-16 Thread Joe
HOUR:MINUTE:SECOND > > the question is how I drop the millisecond?? Take a look at date_trunc() under Date/Time Functions and Operators. Joe ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at

Re: [SQL] psql -F

2006-11-16 Thread Joe Conway
r with the -F option? Sorry for having gone off-topic. I was just hoping something like \t could be passed, too. Try: psql -A -t -U $DBUSER -d $DB -c "$QUERY" -F $'\t' see: man bash HTH, Joe ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Between and miliseconds (timestamps)

2006-11-10 Thread Joe
uisition. I think you want to cast the field, not the constant, e.g., testdb=> select * from t2 where date(tm) = '2006-9-6'; tm --- 2006-09-06 00:00:01-04 2006-09-06 23:59:59.99-04 (2 rows) Joe

Re: [SQL] show privileges

2006-11-06 Thread Joe
ntation under the GRANT privileges section that would help > immensely. I always have to hunt this down when I need it. You mean something like \du at the psql prompt? Joe ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-27 Thread Joe
ier names, you have to use double quotes wherever you refer to the identifier. Without the double quotes, the SQL implementor can either use UPPERCASE (as I believe Oracle and DB2 do) or lowercase (as PG does) when it displays those identifiers. Joe ---(end of broadcas

Re: [SQL] Is this a bug? Deleting a column deletes the constraint.

2006-10-12 Thread Joe
ed if > they reference just the one single column. Ick. I didn't realize before that you can also drop all columns, leaving a table without *any* columns. Is that a SQL92 "feature"? Joe ---(end of broadcast)--- TIP 4: Have

Re: [SQL] Evaluation of if conditions

2006-09-06 Thread Joe
. Expression Evaluation Rules of the manual: The order of evaluation of subexpressions is not defined. In particular, the inputs of an operator or function are not necessarily evaluated left-to-right or in any other fixed order. There's more examples there too. Joe --

Re: [SQL] ERROR: SELECT query has no destination for result data

2006-08-31 Thread Joe
or; You haven't declared numRegistros. Joe ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Data Entry and Query forms

2006-06-29 Thread Joe
Aaron Bono wrote: Are there any web based management tools for PostgreSQL (like Mysql PHP Admin except for PostgreSQL)? I thought I saw a post sometime back about one but don't remember the name. Yes, that's phpPgAdmin (http://phppgadmin.com). Joe

Re: Fwd: [SQL] Start up question about triggers

2006-06-27 Thread Joe
two locations: that's a matter of safety. Slony does it automatically, as long as the daemon is running. No need to control it. But with file-based log shipping (see http://linuxfinances.info/info/logshipping.html) one could write a Java app to control when the updates are applied.

Re: [SQL] avg(interval)

2006-06-26 Thread Joe
2; t - 2006-06-07 22:24:00 2006-06-09 22:21:00 2006-05-31 23:21:00 2006-06-04 22:47:00 2006-06-03 06:05:00 (5 rows) test=> select avg(t - '2006-5-31 0:0'::timestamp) from x2; avg - 5 days 09:47:36 (1 row) Joe -

Re: [SQL] avg(interval)

2006-06-26 Thread Joe
days 22:47:41.749756";"*2420" "3 days 06:05:59.456947";"*2420" which should average to just over nine days - Uh ... how do you arrive at that conclusion? I haven't done the math, but by eyeball an average of four-something days doesn't look out of

Re: [SQL] Repetitive code

2006-06-16 Thread Joe
good idea too because schema changes would be somewhat insulated by the layered views. Best regards, Joe ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Repetitive code

2006-06-16 Thread Joe
mention that because in essence the query is used to materialize a view, i.e., it's part of an INSERT / SELECT into a table which is then joined back to the other tables to construct a web page as well as an RSS feed. Joe ---(end of broadcast)---

[SQL] Repetitive code

2006-06-15 Thread Joe
or 2). Another redundancy is the "date_trunc('day', updated) != created" which is there to avoid selecting "changed" records when they're actually new. However, although creating these views may simplify the subqueries it doesn't seem there is a way to

Re: [SQL] MySQL DB to PostgresSQL DB

2006-05-18 Thread Joe
t; tables (with a textual representation of the columns). An interesting side effect was discovering data inconsistencies in the MySQL database since as part of the conversion I implemented foreign key constraints under PostgreSQL (which were missing in the former). Joe ---

Re: [SQL] query; check for zero and floats

2006-03-31 Thread Joe Conway
end AS A1 from t1 group by g; g |a1 ---+--- 1 | 0.923076923076923 0 | 0 (2 rows) HTH, Joe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-no

Re: [SQL] Question about One to Many relationships

2006-03-24 Thread Joe
d), PRIMARY KEY (band_id, album_id) ) This of course precludes the same band being listed twice in a given album. If you do need that info, then you're really asking for "tracks". Joe ---(end of broadcast)--- TIP 9: In versions belo

[SQL] UPDATE with correlated aggregates

2006-01-29 Thread Joe Abbate
ditional column that coded the type of relationship, but couldn't figure out how to create the summary since the coded column has to be used to add the count to either the "subs" or "items" columns (or subcolumns by type). Thanks for any suggestions and comments. Joe ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-06 Thread Joe Conway
A 1-D array of no elements is '[1:0]={}', just as Joe shows ... or at least it would be except for an overenthusiastic error check: regression=# select '[1:0]={}' :: int[]; ERROR: upper bound cannot be less than lower bound I think this should be a legal boundary case. In ge

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-06-04 Thread Joe Conway
Bruce Momjian wrote: Joe Conway wrote: Any thoughts on how this should be handled for an empty 1D array? No one responed to this email, so I will try. Is this the one dimmentional array you were talking about? test=> select array_dims('{}'::integer[]);

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-26 Thread Joe Conway
ould be handled for an empty 1D array? The point Markus is complaining about seems like it should be easily fixable. Well, "easily" is a relative term. My Postgres hacking neurons have gotten kind of rusty lately -- but then maybe that was your underlying point ;-) Joe In

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Joe Conway
NULL; ?column? -- t (1 row) Joe ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] PGCrypto: Realworld scenario and advice needed

2005-04-11 Thread Joe Conway
E tbl SET f1 = encrypt(decrypt(f1, 'oldkey', 'aes'), 'newkey', 'aes'); Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL

Re: [SQL] Calling a table residing in another database from Plpgsql

2005-01-05 Thread Joe Conway
alled the dblink functions into your database? See README.dblink. Joe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Create Calendar

2004-12-11 Thread Joe Conway
ate_series(0, 19) as t(f1); ?column? 2004-12-01 2004-12-02 2004-12-03 2004-12-04 2004-12-05 [...] 2004-12-20 (20 rows) HTH, Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command

Re: [SQL] PL/pgSQL multidimension (matrix) array in function

2004-09-20 Thread Joe Conway
;plpgsql'; regression=# select * from testarray(2,3); testarray --- {1} {1,1} {1,1,1} {2} {2,2} {2,2,2} (6 rows) HTH, Joe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] reply to setting

2004-08-23 Thread Joe Conway
. Interesting idea -- thanks! Joe ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [SQL] array_in: '{}}'::text[]

2004-08-23 Thread Joe Conway
version - PostgreSQL 8.0.0beta1 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7) (1 row) Look for a fix soon, at a cvs repository near you Joe

Re: [SQL] SQL Challenge: Arbitrary Cross-tab

2004-08-18 Thread Joe Conway
#x27;select case_id, ''cat'' as cat, timekeeper_id from authorized_timekeepers order by 1',4) as t(case_id int, tk1 text, tk2 text, tk3 text, tk4 text); case_id | tk1 | tk2 | tk3 | tk4 -+-+-+-+- 132113 | 021 | 115 | 106 | 14 | 106 | 021 | 115 | 108 213447 | 047 |

Re: [SQL] SQL Challenge: Arbitrary Cross-tab

2004-08-17 Thread Joe Conway
pplication layer procedural code is likely to be the easiest and fastest way to go. crosstab just wraps the procedural code in an SRF for you. Joe ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Wierded error in recursive function; debugging ideas?

2004-08-11 Thread Joe Conway
Josh Berkus wrote: [2] Wrong datatype for second argument in call to in_array SQL: SELECT sf_event_decendants(66645,111) Are you sure this message isn't coming from some PHP middleware, e.g. peardb or something. See: http://us2.php.net/manual/en/function.in-array.php

Re: [SQL] reply to setting

2004-08-11 Thread Joe Conway
-to header. Also true. Joe ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] Wierded error in recursive function; debugging ideas?

2004-08-10 Thread Joe Conway
Version is 7.4.1 There is no in_array() function in Postgres that I'm aware of -- you sure that isn't array_in()? The rest of that error message doesn't seem to be there in 7.4 either. Can we see the function? Joe ---(end of broadcast)---

Re: [SQL] ERROR: Cross-database references are not implemented

2004-08-10 Thread Joe Conway
roughly behave like individual databases do in MSSQL. See: http://www.postgresql.org/docs/7.4/static/ddl-schemas.html If you really need cross-database queries, see contrib/dblink (which would also work across servers), but it isn't as flexible as using schemas. HTH

Re: [SQL] function expression in FROM may not refer to other relations

2004-08-10 Thread Joe Conway
e2 +---+--+---+--- 1 | one |1 | A | A 2 | two |2 | Z | Z 3 | three |1 | A | A (3 rows) Joe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] contrib/tablefunc crosstab

2004-08-05 Thread Joe Conway
_sql) That is the hashed version that will do what you're looking for. HTH, Joe ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Converting a plperlu function to a plpgsql function

2004-07-22 Thread Joe Conway
x27;,'); string_to_array - {1,2,3} (1 row) Second line: if ($r=~/^-([0-9]?)([A-z_]+)/) { my $locid = $1; my $table = $2; Not sure about this one. Hopefully someone else can chime in. Maybe a little less efficient, but it seems like it would be easy enough to parse when true. HTH, Joe

Re: [SQL] Empty array IS NULL?

2004-06-28 Thread Joe Conway
there are some non-trivial technical difficulties to be solved. Unfortunately that won't change in the upcoming 7.5 either :( -- perhaps for 7.6. Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister c

Re: [SQL] Empty array IS NULL?

2004-06-28 Thread Joe Conway
there are some non-trivial technical difficulties to be solved. Unfortunately that won't change in the upcoming 7.5 either :( -- perhaps for 7.6. Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister c

Re: [SQL] Empty array IS NULL?

2004-06-28 Thread Joe Conway
supported, attempting to construct an array with a NULL element results in NULL, not an empty array. Joe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] pivot-like transformation

2004-06-20 Thread Joe Conway
/static/arrays.html http://www.postgresql.org/docs/7.4/static/functions-array.html http://www.postgresql.org/docs/7.4/static/functions-comparisons.html http://www.postgresql.org/docs/7.4/static/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS HTH, Joe ---(end of broadcast

Re: [SQL] Last day of month

2004-06-08 Thread Joe Conway
date_trunc('month', current_date + '1 month'::interval); date_trunc - 2004-03-01 00:00:00 (1 row) Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command

  1   2   3   >