Re: [SQL] random rows

2001-04-26 Thread Josh Berkus
END LOOP END; than: SELECT temptable -Josh -- __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small bus

Re: [SQL] How to encode and decode password in pgsql !!

2001-05-03 Thread Josh Berkus
D'Arcy, > You use the chkpass type that I just commited to the distribution > (finally.) > Here is an example of its usage. Does that mean that chkpass is part of 7.1, or only the current CVS? -Josh __

Re: [SQL] Dateadd

2001-05-05 Thread Josh Berkus
). Speaking of which, why doesn't PostgreSQL allow the use of "+" between two VARCHARs to mean the same as "||" ? Is there an addition operation for PgSQL for VARCHAR other than concatination? -Josh > > I need to know if there is a sql function implemented in postgres

[SQL] Need help with search-and-replace

2001-05-05 Thread Josh Berkus
. RIght now, I'm copying the file to a Win32 machine and using MS Word for the search-and-replace, but I'm sure there's got to be a better way ... *without* learning VI or Emacs. Help? -Josh __AGLIO DATAB

Re: [SQL] calling a function within a view causes problems doing a pg_dumpall

2001-05-07 Thread Josh Berkus
estore. Could it be as simple as the dump file trying to create the view before the function? Or plpgsql not being defined as a language on the target server? BTW, there is a better-performance way to do the same thing you're doing with that function. Please browse the list archives with

Re: [SQL] Order by email address

2001-05-10 Thread Josh Berkus
the line. If e-mail addresses are that important to your application, I greatly encourage you to split the field. -Josh Berkus P.S. Roberto, please add the above to our function library. __AGLIO DATABASE SOLUTIONS___ Josh Berkus Co

Re: [SQL] Order by email address

2001-05-10 Thread Josh Berkus
t; 1), 60) AS CHAR(60)); > RETURN mail_box || mail_domain; I meant: RETURN mail_domain || mail_box; > END;' > LANGUAGE 'plpgsql'; > > Then: > > SELECT user_id, email, email_sort(email) as sortcol > FROM users > ORDER BY sortcol; > -Josh

Re: [SQL] Unique record Identifier?

2001-05-30 Thread Josh Berkus
r that will allow you to backfill exisiting records. 2. Add a column of type INT4 to each table ('gsq') 3. Create the default value of this column as NEXTVAL('gui_sq'). 4. Backfill existing records. 5. Add a unique index on each table for this column. You

[SQL] Re: rowset Return from postgresql

2001-05-31 Thread Josh Berkus
) c. Return the s_key from the function. 5. Query from you front-end app on sv_results JOIN searches where search_sq = s_key. This works quite well, especially for web applications. -Josh __AGLIO DATABASE SOLUTIONS___ J

Re: [SQL] Date manipulation

2001-06-01 Thread Josh Berkus
interval, and while you can add an interval to a date you cannot add two dates. Additionally, if you browse to Roberto Mello's PG/plSQL function library (see link for the PostgreSQL.org web site) you will find an extension to the OVERLAPS function that I find quite useful (I should, I wrote it!

Re: [SQL] question about PL/pgSQL function

2001-06-01 Thread Josh Berkus
how do I > get the > returned record in PL/pgSql No, it is not possible. I know the list archives are kinda hard to search, but we've discussed this question ad naseum; in fact, I just provided a workaround earlier this week. -Josh __AGLIO DATABASE SOLUTIONS______

[SQL] PGAccess/pgplsql Blues

2001-06-01 Thread Josh Berkus
pts to use the function after PGAccess editing are met with: 'Parse error at or near ""' Once the *identical* function text is reloaded via PSQL command-line, however, the function works. I'm using Postgres 7.1 RC2 and PGAccess 0.98.5.

[SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
ly, what I want is: SELECT ALL Wednesdays BETWEEN 5/1/01 AND 6/1/01; Which results in: Wednesdays --- 5/2/01 5/9/01 5/16/01 5/23/01 5/30/01 Thanks for any suggestions! -Josh Berkus __AGLIO DATABASE SOLUTIONS_

Re: [SQL] PGAccess/pgplsql Blues

2001-06-04 Thread Josh Berkus
em: 1. Test fn_save_order: it's working. 2. Open fn_save_order in PGAccess. 3. Add '--test comment' on its own line. 4. Save fn_save_order. 5. test it: "Parse Error at or near "" " Unfortunately, I can't afford to pay Constatin for d

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
mn x. This requires me to build a list of all possible Wednesdays (within a date range), preferably *without* first having a table of all dates in existance! Some sort of manipulation of the date processor should be possible, shouldn't it? -Josh Berkus __AGLIO DATABASE SOLUTIONS_

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
s isn't made easier by the fact that functions currently > can't > return sets without extreme wizardry. Thanks for the feedback ... it's good to know at least when something is impossible. Looks like I'll have to build a nightly table of all Wednesdays in the las

[SQL] Huh? Data typing bug?

2001-06-04 Thread Josh Berkus
Folks, I just subtracted two dates and got an INT4, rather than the INTERVAL I was expecting. What goes on here? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED

Re: [SQL] Huh? Data typing bug?

2001-06-04 Thread Josh Berkus
significantly. This makes some sort of sense, now. Correct me if I'm wrong: DATE + INT4 = DATE DATE - DATE = INT4 But: DATETIME + INTERVAL = DATETIME DATETIME - DATETIME = INTERVAL -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] SQL Date Challenge

2001-06-04 Thread Josh Berkus
ERT INTO timecard_due_dates ( assignment_usq, week_ending ) SELECT assignments.usq, check_date FROM assignments WHERE (status > 2 OR (status < 0 AND status > -81)) AND start_date <= check_date AND end_da

Re: [SQL] sql hard question

2001-06-05 Thread Josh Berkus
r) + '.' + RTRIM(x.LANG)) t = y.SRC_ID __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small b

Re: [SQL] seleting all dates between two dates

2001-06-06 Thread Josh Berkus
ery issue. The answer, in short, is that you can't do it in SQL. Your choices are to build the reference table, or to use and external procedural language (such as Perl). -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus

Re: [SQL] creating variable views

2001-07-07 Thread Josh Berkus
s error would be. The last thing I want for my users is to have to contend with "5301: No rights on TABLE client_contacts." -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology

Re: [SQL] creating variable views

2001-07-06 Thread Josh Berkus
ng SQL DB security, this can be a serious headache, as opposed to a single update with an interface-based system. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data

Re: [SQL] indexing of hierarchical data

2001-07-06 Thread Josh Berkus
odes within their context without tying up those codes for all time or preventing your users from changing the codes. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and

Re: [SQL] Cross database foreign keys

2001-07-06 Thread Josh Berkus
meday in the future, but then again it may not (it's a design philosophy issue, I believe). I don't know of *any* RDBMS that allows foriegn keys between databases! If referential integrity is your goal, why on earth is the related data in two different databases? -Josh Berkus

Re: [SQL] PGAccess/pgplsql Blues

2001-07-09 Thread Josh Berkus
t worth it to me to hunt down the issue. -Josh > FYI, I could not reproduce this problem in the current CVS sources. > > I created a function 'select 1;' and saved it, then opened the > function > and added a comment line, saved that, and it worked fine. > > >

[SQL] Problems with PG_DUMP and restore

2001-07-10 Thread Josh Berkus
were restored but many were not. No errors were logged. Can someone give me some help? The application is due next week, and I can't afford this setback. Grazie. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Com

Re: [SQL] Problems with PG_DUMP and restore

2001-07-10 Thread Josh Berkus
files -- one for DDL, one for data -- that it fails. BTW, I'm using 7.1RC2 -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 5

[SQL] Help! Failure of pgdump -a

2001-07-10 Thread Josh Berkus
were restored but many were not. No errors were logged. Can someone give me some help? The application is due next week, and I can't afford this setback. Grazie. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Com

Re: [SQL] SQL question

2001-07-10 Thread Josh Berkus
.SQL for Smarties > Also, would you be able to tell me how to use > a > nested DQL quesry/join query with an ADO command object, i.e the > commandtext > property? Thank you for your help. This is the wrong list for questions about ADO. Try pgsql-interfaces instead, or perhap

Re: [SQL] ERROR: Procedures cannot take more than 16 arguments

2001-07-10 Thread Josh Berkus
Peter, > FUNC_MAX_ARGS in config.h; see the comments there. Darn! I asked this a year ago, and was told by somebody at Hub.org that it couldn't be changed ... -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus

Re: [SQL] Functions performed on intervals

2001-07-12 Thread Josh Berkus
Design by F. Pascal) to include date ranges; 4) You can even add a "leave time rule history" table to keep track of how leave time is calculated over the history of the company (e.g. what if leave time was 14 days per year through 1999, but decreased to 10 days per year in 2000?) 5) Any

Re: [SQL] Functions performed on intervals

2001-07-12 Thread Josh Berkus
run on a (daily/weekly/monthly) basis. 3. Create a cron item that calls the shell script (1.). Handling errors etc. obviously adds a layer of complexity to the scripting. I also have the functions write to a schedule_log table showing what they've done. -Josh __AGLIO DATABASE SOLUTION

[SQL] Date Validation?

2001-07-13 Thread Josh Berkus
ng the dates in only one format, and b) be really complicated for leap years and the millenium. I am hoping that someone has already dealt with this issue in a way that date validation can be trappable. Thanks for your advice. -Josh Berkus __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Referencing a view?

2001-07-13 Thread Josh Berkus
t and address for each company. Of course, this all requires some sophistication in the user interface, as one has to make the user distinguish between address corrections (UPDATE) and new addresses (INSERT) which possibly replace old addresses (UPDATE SET STATUS = old). -Josh Berkus _

Re: [SQL] Date Validation?

2001-07-13 Thread Josh Berkus
Richard, > Out of curiosity Josh, why aren't you validating in PHP? - only takes > a > couple of lines there. We are. It's just that all other validation takes place inside the PL/pgSQL functions in order to keep all the business logic in the database. Having one form o

Re: [SQL] You have an error in your SQL syntax near '' at line 1

2001-07-13 Thread Josh Berkus
of things, but no change. The first thing you should do is modify your program so that it outputs the query text it's actually passing to the database to a text file or stdout instead. Once you see the actual query and not a bunch of string variables, the error ma

Re: [SQL] Date Validation?

2001-07-14 Thread Josh Berkus
--- > 2001-01-01 BC | 0001-01-01 BC > (1 row) Quick! Call the presses! Stop the computers! I could also make a number of Christian theological jokes, but I don't want to offend anyone on the list -Josh __AGLIO DATABASE SOLUTIONS___

[SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Tom, Stephan, Hey! I thought you couldn't do ORDER BY in views ... yet I just did. Is this a new thing, or am I just getting my Trasact-SQL and my PostgreSQL mixed up again? -Josh __AGLIO DATABASE SOLUTIONS___ Josh B

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
LECT * FROM test_view ORDER BY city; Does the second ORDER BY override or suppliment the view ORDER BY, or is it ignored? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTE

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
to code in an exception to the VIEW optimizer that doesn't push down WHERE clauses if the VIEW has an ORDER BY ... LIMIT statement. Sure you wanna get into this? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete in

Re: [SQL] How Postgresql Compares For Some Query Types

2001-07-17 Thread Josh Berkus
elds from the query, it gives me the <7s response time I'd expected. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTE

Re: [SQL] using custom column names in a group by clause

2001-07-17 Thread Josh Berkus
wice, then it doesn't matter which one you group by. Third, Matt, PostgreSQL 7.1.2 DOES support aliasing in GROUP BY clauses. Maybe it's time to switch databases? select client_name as clname1, client_name as clname2, AVG(status) from clients group by clname1, clnam

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Josh Berkus
ns. You'll need to get advice from other list members or the docs (and don't forget the "non-FAQ Documentation" page!) on how to use these other languages, as I have had no need for them, to date. -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Josh Berkus
l/pgsql part is > just a > small portion of the whole thing. I still need to figure out a way to > export > data which I calculate to let gnuplot create pretty pictures for me. > > And today is the first day, I try pl/pgsql ... Today, the data import > program mus

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Josh Berkus
ve no time to look at it myself; > any volunteers out there? While you're (whoever) at it, OFFSET won't take expressions either. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology

Re: [SQL] pl/pgsql - code review + question

2001-07-19 Thread Josh Berkus
Richard, > > Josh - if I try and do OFFSET at the same time (presumably it's the > same > > change) do you fancy acting as a sanity test site? > > What am I talking about - OFFSET is going to be parsed by the SQL > parser not > the plpgsql parser. Not so, n

Re: [SQL] Query optimizing - paradox behave

2001-07-19 Thread Josh Berkus
old increase in JOIN performance by switching to INT8 keys. In practice, its probably more like double or triple but that ain't bad, either. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information

Re: [SQL] nextval on insert by arbitrary sequence

2001-07-19 Thread Josh Berkus
re-arrange the rows according to some external criteria. If it were me, I'd do it through interface (or better) middleware code, disabling the user's ability to insert or delete rows directly and forcing them to push inserts and deletes through some kind of function, whether PL/pgSQL or Java-

Re: [SQL] multiple lookup per row

2001-07-20 Thread Josh Berkus
l') cp ON members.mid = cp.mid ORDER BY members.name; You're experiencing the usual problem encountered by procedural programmers when they first start on SQL. SQL is a declarative language, and requires a different knid of thinking than procedural languages. Thus the use

Re: [SQL] Records exactly the same.

2001-07-20 Thread Josh Berkus
data in your query, you can insure that all records are displayed. Frankly, I'm surprise that you're not getting errors when you try to DELETE a record. This usually happens in tables without a unique key. It's been my argument for some time that PostgreSQL should require a pr

Re: [SQL] multiple lookup per row

2001-07-20 Thread Josh Berkus
is designed to do. Plus my way and Tom's way can be built as views, allowing further optimization. Not to mention that pure SQL will always be faster than even a trusted language. In other words, my and Tom's queries should run about 50 times as fast as the procedural method for large

Re: [SQL] nextval on insert by arbitrary sequence

2001-07-20 Thread Josh Berkus
Dado, Maybe we're looking at this the hard way. Have you thought of simply putting in a DATETIME column and sorting by that? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [

Re: [SQL] TODO List

2001-07-20 Thread Josh Berkus
Bruce, Chris, A lot of us would like a fuller PL/SQL implementation in PL/pgSQL. However, Jan is busy with other things and I don't see anyone stepping up to the plate to take on the project. -Josh __AGLIO DATABASE SOLUTIONS__

Re: [SQL] Re: PLpgSQL

2001-07-21 Thread Josh Berkus
N > >>seq_name := ''proj_pts_'' || proj_ID; > >>create sequence seq_name; > >>END; > >>RETURNS seq_name;' This should read: RETURN seq_name No "S". > >>LANGUAGE 'plpgsql'; -Jos

[SQL] Full-text Indexing and Primary Keys

2001-07-23 Thread Josh Berkus
eSQL require a primary key at table creation. Frankly, I'm a little mystified as to why this was not done already, but it's not too late to correct ... -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete informa

Re: [SQL] Re: Records exactly the same.

2001-07-23 Thread Josh Berkus
learned the hard way. For a more exhaustive explanation of the necessity of uniqueness and primary keys, please pick up a copy of Fabian Pascal's "Practical Issues in Database Design." -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] RE: position(text,text) function

2001-07-23 Thread Josh Berkus
Jeff, Karl, Actually, he's confusing 3 functions. See postgresql.org --> user lounge --> interactive docs --> functions and operators --> string functions. -Josh > You are confusing the syntax of two similar functions: > position ('substring' in 'string&#

Re: [SQL] how can we get total records in pg server?

2001-07-24 Thread Josh Berkus
tals". If you would prefer another language, poll the list -- someone may be familiar with other texts. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] an

Re: [SQL] Re: Inserts in triggers Follow Up

2001-07-25 Thread Josh Berkus
ntical column and variable names will confuse the compiler and result in errors. It'd have been nice if PL/pgSQL supported variable naming with a special character preifx (e.g. $variable). Does anyone know of a character that won't give the parser fits?

Re: [SQL] Meta integrity

2001-07-25 Thread Josh Berkus
of direct SQL command access. I took the second approach to solve a similar problem, because I had quite a number of other business rules I needed to apply, and adding the special relationship rule was only one more. -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Re: Inserts in triggers Follow Up

2001-07-25 Thread Josh Berkus
n there are. This is good because it now means I can use the logical syntax of SELECT data INTO var ... which to me is easier to read, for everything. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete informat

Re: [SQL] Restriction by grouping problem.

2001-07-26 Thread Josh Berkus
just need to group the min(datetime) by it. The answer to this question is simple: SELECT min(datetime) as mintime FROM logs GROUP BY sid; However, I get the impression that your intended problem was more complicated. Can you re-explain it? -Josh __AGLIO DATABASE SOLUTIONS

Re: [SQL] nullif BUG???

2001-07-27 Thread Josh Berkus
Guard, > > select nullif(NULL,5) > > ++ > | case | > ++ > | | > ++ > Er... what were you expecting, exactly? Except for IS NULL (and COALESCE, which uses IS NULL) any operation involving a NULL is also NULL. -

Re: [SQL] Re: Restriction by grouping problem.

2001-07-27 Thread Josh Berkus
it selects the first one alphabetically so that you don't get two files for one SID. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 5

[SQL] Fuzzy matching?

2001-07-31 Thread Josh Berkus
tely unsuitable for column comparisons on large tables. Can anyone suggest some shortcuts here? Perhaps using pl/perl or something similar? Grazie! -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information te

Re: [SQL] Fuzzy matching?

2001-07-31 Thread Josh Berkus
but metaphone is not so useful for non-english versions of postgres. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for

Re: [SQL] Fuzzy matching?

2001-07-31 Thread Josh Berkus
grams existed outside fo expensive proprietary software. Now, who can I talk into porting them (metaphone, levenstein) to Postgres? Hey, GreatBridge folks? (this would be a significant value enhancement for Postgres) -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Fuzzy matching?

2001-07-31 Thread Josh Berkus
n't help with the porting of metaphone or levenstein (but will benefit immensely), I pledge to write a name-alike data checking PL/pgSQL function which I will post to Roberto's library for public consumption. -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Converting epoch to timestamp?

2001-08-01 Thread Josh Berkus
but by then > hopefully we'll have changed things...) Yeah, sure. That's what my father said in 1964 when they talked about the potential problems with 2-digit dates on the UNIVAC II ... ;-) -Josh __AGLIO DATABASE SOLUTIONS___

Re: [SQL] converting timestamps to ints

2001-08-03 Thread Josh Berkus
for you to work with; DATE/INTEGER is easier for math, and DATETIME/INTERVAL is easier for calendar comparisons. See the docs on data types, functions, and operators at PostgreSQL.org. -Josh Berkus __AGLIO DATABASE SOLUTIONS___

[SQL] Data type confusion

2001-08-05 Thread Josh Berkus
AQ, as it seems inconsistent behavior. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (415) 565-7293 for law firms, small businesses

Re: [SQL] Re: Date Time Functions - ANSI SQL ?

2001-08-05 Thread Josh Berkus
erver is so far off the ANSI standard for Dates & Times that no application may be ported from another server which relies on dates and time manipulation. FYI. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Comp

Re: [SQL] Data type confusion

2001-08-05 Thread Josh Berkus
ry. :( I'm stricly a "high-level user". I can, however, document it so that others won't pester you for questions about why it doesn't work. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complet

Re: [SQL] Re: Data type confusion

2001-08-06 Thread Josh Berkus
s 3 months'::INTERVAL / '1 week'::INTERVAL (and we don't care about the fractional week left over). Thus we don't want to hold up simple and obvious date multiplication and division just to deal with the wierdo cases. -Josh Berkus __AGLIO DATABASE SOLUTIONS

Re: [SQL] Re: Data type confusion

2001-08-06 Thread Josh Berkus
ired) / '2 weeks'::INTERVAL I don't want to go through a bunch of non-ANSI SQL-compliant conversion functions to do it. Especially not as this is just what the ANSI SQL data type and operator specs are designed to support. -Josh ______AGLIO DATABASE SOLUTIONS__

Re: [SQL] Re: Data type confusion

2001-08-06 Thread Josh Berkus
o I propose that we suppot the first two and disallow the third. Thus I think that we can adhere to the spec, while still providing the functionality developers want and avoiding a whole lot of '5 months 11 minutes' type headaches. -Josh __AGLIO DATABASE SOLUTIONS

Re: [SQL] Re: Data type confusion

2001-08-06 Thread Josh Berkus
to: to_weeks(current_timestamp - hire_date) / '2 weeks' ... otherwise division and multiplication operators for time values don't do us much good, as we'd be forced to integer-ize all intervals before we can perform any operations on them at all

[SQL] Re: [warning: largely off-topic] Re: Data type confusion

2001-08-06 Thread Josh Berkus
their local time and date according to local rules (admins of worldwide web servers exempted). So ... my first question: surely someone has grappled with this problem already? Surely some professor of C.S. in a university somewhere has an answer for us? -Josh P.S. My head hurts, now. __A

Re: [SQL] views and null bothering

2001-08-06 Thread Josh Berkus
, > but have > lots of trouble makeing it put correctly the columns that have NULL > values. You need to use LEFT OUTER JOIN, supported in Postgres 7.1.x. See the current postgresql docs, or your favorite ANSI-SQL handbook, for guidance. -Josh Berkus __AGLIO DATABASE SOLU

Re: [SQL] Simple Insert Problem

2001-08-06 Thread Josh Berkus
e,start_time) Values > (5400,Welding,06:00:00); Because you've forgotten the quote marks. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data manageme

Re: [SQL] Simple Insert Problem

2001-08-06 Thread Josh Berkus
-to address -- thus forcing me to reply to the list. > Gonzo, > > Maybe that question belongs in the pgsql-novice list instead. This > list is > for the experts like myself. Hey, you're right. I'll use something similar to that reply next time.

Re: [SQL] Are circular REFERENCES possible ?

2001-08-07 Thread Josh Berkus
ondary HR and billing addresses. Your third alternative is to create a JOIN table called Default Shops. However, this does not really provide you any additional referential integrity -- it jsut may suit you if you find triggers intimidating. -Josh __AGLIO DATABASE SOLUTIONS_____

Re: [SQL] Re: Adding an INTERVAL to a variable

2001-08-07 Thread Josh Berkus
TERVAL, which will recognize '# days' as a valid expression. IMHO, you've been lucky being able to skip the parens and CASTs so far; get used to using them. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Com

Re: [SQL] Why can't I .........

2001-08-07 Thread Josh Berkus
.. update table1 set table1.col1=value Because UPDATES, per the SQL 92 standard, are on one table only. Thus any refenced columns *must* belong to that table, and if so, why name it? -Josh Berkus __AGLIO DATABASE SOLUTIONS___

Re: [SQL] Are circular REFERENCES possible ?

2001-08-07 Thread Josh Berkus
ERT/UPDATE operation inside a function, does it automatically wait until the function completes before checking constraints? > Josh, maybe you should buy a newer SQL-bo... :-) > > Got ya (LOL)! Zap! Ouch. ;-) > > The point is that we based our implementation of fore

[SQL] Name Alike Challenge

2001-08-07 Thread Josh Berkus
rent names that come up as identical? 3. Can anyone turn this function on its head, and rather than having it accept 2 first/last names and a looseness factor and return TRUE/FALSE, have it accept the two name pairs and return a looseness factor? Go for it! -Josh Berkus __AGLIO

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Josh Berkus
o monkey around with custom triggers. > 2. Can a column reference another column in the same table? eg.. > > CREATE TABLE bloo ( > id int4, > p_id int4 REFERENCES bloo (id) > -- or > --p_id int4 REFERENCES (id) > ) Er ... why w

Re: [SQL] Functions returning more than one value

2001-08-08 Thread Josh Berkus
ented) language instead. Java, Python, Perl and even 4GL would provide you with more robust functionality. For example, what you want is easily done in Java just by passing the input parameters as By Reference. Opinions on Middleware languages, anyone? -Josh Berkus __AGLIO DATABASE SOLUTI

Re: [SQL] REFERENCES constraint

2001-08-08 Thread Josh Berkus
FERENCES ... you do it with a CHECK CONSTRAINT (look it up in the docs). -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data management solutions (

Re: [SQL] Problem with aggregate functions and GROUP BY

2001-08-08 Thread Josh Berkus
(SELECT max(sortby) as maxsort, fk FROM test GROUP BY fk) maxtest WHERE test.fk = maxtest.fk AND test.sortby = maxtest.maxsort; There's also a pgsql extension called SELECT DISTINCT ON, but it's not SQL 92 standard so I don't reccomend it. -Josh __A

Re: [SQL] REFERENCES constraint

2001-08-12 Thread Josh Berkus
ight are in the same table and are in a different table from banana_data and apple_data. Or, perhaps, as a very advanced user, I'm just making some very advanced mistakes ... -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus

Re: [SQL] optimizing select ... not in (select ...)

2001-08-13 Thread Josh Berkus
ming that PictureID is the unique index of Pictures, are completely superfluous and will only slow the query down. Particularly the use of DISTINCT in a subquery should only be used if the contents of the subquery will be displayed as part of the result set. -Josh Berkus __AGLIO DATABASE SOL

[SQL] Eh?

2001-08-13 Thread Josh Berkus
Tom, Stephan, SHould I be concerned about this? DEBUG: geqo_main: using edge recombination crossover [ERX] DEBUG: geqo_main: using edge recombination crossover [ERX] It happens when I run a truly massive (>2000 chars) query ... -Josh __AGLIO DATAB

Re: [SQL] Eh?

2001-08-13 Thread Josh Berkus
struction test" for the GEQO, hey? The only thing I'm missing is a couple of LEFT OUTER JOINS and maybe a WHERE NOT EXISTS. -Josh P.S. The purpose of the view is to "flatten" a large chunk of complex relational data into a comma-delimited text table to be

Re: [SQL] DateDiff, IsNull?

2001-08-14 Thread Josh Berkus
for which you have the skill and the time. The advisability of doing so, however, is another thing entirely ... Given that all of the MS SQL Server "peculiarities" are not ANSI SQL standard, have you given any thought to porting by search-and-replace script instead of trying to make

[SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Josh Berkus
ing itself once it's in heavy use. I though that MVCC was supposed to supercede deadlocks, unless I specifically set locks, which I'm not. Help, anyone? -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus

Re: [SQL] Deadlocks? What happened to MVCC?

2001-08-14 Thread Josh Berkus
ound the problem after 3 hours and a phone call to PostgreSQL Inc. Turns out that I had one too-broad UPDATE in a 250-line function ... feh! -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology

Re: [SQL] result sets from functions...

2001-08-14 Thread Josh Berkus
;" Unfortunately, PostgreSQL functions do not yet return result sets. This is on the "todo" list but unfortunately requires an overhaul of how postgresql functions work. -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Jo

Re: [SQL] Re: Re: DateDiff, IsNull?

2001-08-15 Thread Josh Berkus
AR + VARCHAR. So how is defining it as a concatination operator (whatever other problems there might be with that) "overloading"? Or am I missing the point? -Josh Berkus __AGLIO DATABASE SOLUTIONS___ Josh Berkus

<    1   2   3   4   5   6   7   8   9   >