Re: [GENERAL] Range-Types in 9.2

2012-08-04 Thread Scott Bailey
On 08/03/2012 08:06 AM, Andreas Kretschmer wrote: Hi all, great feature, but i can't find a TIMERANGE, i want to store time-ranges, for instance [10:00:00,16:00:00), how can i do that? Regards, Andreas Time ranges could be more complicated than you realize. You'd have problems if you

Re: [GENERAL] Chicken/egg problem with range types

2012-07-18 Thread Scott Bailey
On 07/17/2012 08:08 PM, Tom Lane wrote: I wonder whether we could improve this by postponing the no-shell-types check from creation to function runtime. It would be annoying to have to make an additional catalog lookup at runtime just for typisdefined, but I think that probably we could fold it

[GENERAL] Some feedback on range types

2012-07-18 Thread Scott Bailey
I'm testing range types and I've come up with a couple of curiosities. 1) I'll start off easy. In the wild, discrete ranges tend to be closed-closed [] while continuous ranges tend to be closed-open [). For instance, on Tuesday stock traded at [28.34, 32.18] or Bob was employed [2009-06-01,

[GENERAL] Chicken/egg problem with range types

2012-07-17 Thread Scott Bailey
CREATE TYPE dt_range AS RANGE ( SUBTYPE = timestamptz, SUBTYPE_DIFF = dt_subtype_diff -- CANONICAL = dt_range_canonical -- can't use, fn doesn't exist ); ALTER TYPE dt_range SET CANONICAL = dt_range_canonical; This doesn't work either. I'm stuck. Scott Bailey -- Sent via pgsql-general

[GENERAL] Chicken/egg problem with range types

2012-07-17 Thread Scott Bailey
CREATE TYPE dt_range AS RANGE ( SUBTYPE = timestamptz, SUBTYPE_DIFF = dt_subtype_diff -- CANONICAL = dt_range_canonical -- can't use, fn doesn't exist ); ALTER TYPE dt_range SET CANONICAL = dt_range_canonical; This doesn't work either. I'm stuck. Scott Bailey -- Sent via pgsql-general

Re: [GENERAL] SQL Programming Question

2010-09-10 Thread Scott Bailey
On 09/10/2010 08:07 PM, t...@exquisiteimages.com wrote: I have a situation where I receive a file with transactions that have a unique key from a vendor. These transactions should only be imported into my system once, but the vendor system will occasionally resend a transaction by mistake. The

[GENERAL] Invalid objects

2010-04-23 Thread Scott Bailey
advice as to how it may best be done? Thanks Scott Bailey -- 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] count function alternative in postgres

2010-04-03 Thread Scott Bailey
junaid malik wrote: Is there any alternative of mysql function COUNT(DISTINCT expr, [expr...]) in postgres. We get error if we write count like this count(distinct profile.id, profile.name, profile.age) but it works well in mysql. Reference url is given below

Re: [GENERAL] any built-in function to get time in seconds?

2010-04-03 Thread Scott Bailey
zhong ming wu wrote: I have been using this one liner c function that I call my_now() to get the number of seconds since some fixed point in the past. I find it more convenient than built-in now() and if I want abstime I do abstime(my_now()). Thing is everytime I do a major version upgrade I

Re: [GENERAL] Function with DEFAULT arguments

2010-03-12 Thread Scott Bailey
a default value, the function call may look like: SELECT foo(default, 'hello', 43) Scott Bailey -- 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] to_timestamp() and quarters

2010-03-02 Thread Scott Bailey
Tom Lane wrote: Asher Hoskins as...@piceur.co.uk writes: I can't seem to get to_timestamp() or to_date() to work with quarters, The source code says * We ignore Q when converting to date because it is not * normative. * * We

Re: [GENERAL] Array columns vs normalized table

2010-03-02 Thread Scott Bailey
Lee Hachadoorian wrote: I work with state labor data which is reported to us in the form industry, year, quarter1, quarter2, quarter3, quarter4 where each quarter represents an employment count. Obviously, this can be normalized to industry, year, quarter, employment Can

Re: [GENERAL] What is unsecure postgres languages? How to disable them?

2010-02-22 Thread Scott Bailey
dipti shah wrote: Sorry Albe for confusion. Yes, I meant untrusted languages like C, PL/PerlU, PL/PythonU etc... Thanks a lot you and Tino for nice reply. Could you guys tell me how could I verify whether those languages are installed on my PostGreSQL server? Thanks for being there, Dipti

Re: [GENERAL] GROUP BY column alias?

2010-02-18 Thread Scott Bailey
Eric B. Ridge wrote: Maybe I'm getting too old to SQL anymore, but I ran across something yesterday in a machine generated query that took me over an hour to figure out. Here's a little testcase. Maybe somebody can explain why the last Not Expected case does what it does. select version();

Re: [GENERAL] GROUP BY column alias?

2010-02-18 Thread Scott Bailey
Eric B. Ridge wrote: On Feb 18, 2010, at 4:31 PM, Scott Bailey wrote: I'm not sure why you would be surprised by that behavior. You are grouping by a timestamp, so any microsecond difference will be a new group. I get that. ;) Hence the ::date. This is what doesn't make sense: Expected

[GENERAL] returning records from plpython

2010-02-17 Thread Scott Bailey
Does anyone know why plpython doesn't support returning record? I couldn't find anything in the archives or source that indicated why it wasn't supported. I'm trying to do Oracle style external tables and xmltable and it would make it much easier if I could return setof record. Scott -- Sent

Re: [GENERAL] COPY FROM wish list

2010-02-16 Thread Scott Bailey
Marc Mamin wrote: Hello, Looking at the TODO List, I feel that only some aspects of the COPY FROM command are adressed. Could a discussion trigger some activity on this topic :o) ? Best regards, Marc Mamin Here my wish list: COPY tablename [ ( column [, ...] ) ] FROM { 'filename' |

Re: [GENERAL] Calling a plpgsql function with composite type as parameter?

2010-01-15 Thread Scott Bailey
Jamie Begin wrote: I'm working on an e-commerce site that calls various plpgsql functions from a Python app. One of the things I need to do is create a shopping cart and add several items to it. I'd like for both of these steps to be contained within the same transaction so if an error occurs

Re: [GENERAL] converting tables to XML and back

2010-01-05 Thread Scott Bailey
shulkae wrote: We have few tables which we would like to convert to XML and store it. Another requirement is to convert the stored XML file back to the original tables. This helps us to clone a system. I was thinking to use Perl XML Simple module to generate XML files. How do I again

Re: [GENERAL] Something like Oracle Forms, but Open Source to use with PostgreSQL?

2009-12-21 Thread Scott Bailey
is not. Scott Bailey -- 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] [General] beginner!!!

2009-12-09 Thread Scott Bailey
My silly question is, do I needo to install a postgreSQL server or the freeradius-postgresql package already takes care of it?! My question it's because it doesn't recognize any user ids and the createuser command. Yeah, that's pretty much the way things work on unix-like systems. Instead

Re: [GENERAL] [COMMITTERS] recover deleted records

2009-11-24 Thread Scott Bailey
be problems with the freespace map or other issues that I'm not aware of, but I'd probably at least try it if I was going to lose my job or the company lose mega $ over it. Scott Bailey -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] I need help creating a composite type with some sort of constraints.

2009-11-23 Thread Scott Bailey
John Oyler wrote: I can create one or more domains, and use those to create the composite type from. But each domain can only be constrained in its own value, I can't constrain element #1's value based on what element #2's value is. If I create a domain from a composite, it will complain with a

Re: [GENERAL] obtaining ARRAY position for a given match

2009-11-19 Thread Scott Bailey
Pedro Doria Meunier wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I'm trying to get the array position for a given match as thus: This gets me the record for a given match: SELECT * FROM garmin_units WHERE 'L' = ANY (protocol_tag); Ok. so far so good... But what about getting the

Re: [GENERAL] obtaining ARRAY position for a given match

2009-11-19 Thread Scott Bailey
FROM generate_series(array_lover($1,1),array_upper($1,1)) g(i) Pavel, Don't get me wrong, I enjoy coding, but I think you've taken it too far here ;) Yes, definitely more effective for large arrays. Thanks. Would probably be a good snippet for the wiki. Scott -- Sent via

Re: [GENERAL] obtaining ARRAY position for a given match

2009-11-19 Thread Scott Bailey
Sam Mason wrote: On Thu, Nov 19, 2009 at 05:24:33PM +0100, Pavel Stehule wrote: it should be little bit more effective: I'm not sure if it will be much more; when you put a set returning function into a FROM clause PG will always run the function to completion---as far as I know, but I've

Re: [GENERAL] obtaining ARRAY position for a given match

2009-11-19 Thread Scott Bailey
this was actually a pretty typical solution to dealing with arrays until we got 'unnest()'. See information_schema._pg_expand_array for example. Oh I know. I was just having a laugh at the array_lover function. Now that I think about it, we could replace array_agg() with array_orgy() and

Re: [GENERAL] obtaining ARRAY position for a given match

2009-11-19 Thread Scott Bailey
Sam Mason wrote: On Thu, Nov 19, 2009 at 09:46:42AM -0800, Scott Bailey wrote: We had an idx() function in the _int contrib module. I wonder if it would be useful to write this in C now that _int is deprecated? Is idx really the best name for this? there could be multiple occurrences

[GENERAL] Possible bug with array_agg

2009-11-19 Thread Scott Bailey
probably document it. Scott Bailey -- 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] Possible bug with array_agg

2009-11-19 Thread Scott Bailey
Pavel Stehule wrote: Hello 2009/11/19 Scott Bailey arta...@comcast.net: On 8.4.0 I found that array_agg does not return a value when fed more than 12,000 values. (12,000 worked and 13,000 did not.) can you send a query? postgres=# create table f(a int); CREATE TABLE postgres=# insert

Re: [GENERAL] Possible bug with array_agg

2009-11-19 Thread Scott Bailey
I'm not sure which release you use, but it works for me (1.10 and 1.11). The result of the first query is badly displayed (remember that it tries to display an array of 10 integers), but the query returns something that pgAdmin tries to display. The others work too but the display is

[GENERAL] Enum on-disk format

2009-11-18 Thread Scott Bailey
were much wider than I thought they would be, 28 bytes + 2 byte spacer to store 4 bytes of data. Is there any way to see which bytes of an item pointer actually map to columns in a table? And where can I find more info on how Postgres stores tuples? Scott Bailey -- Sent via pgsql-general

Re: [GENERAL] Enum on-disk format

2009-11-18 Thread Scott Bailey
Tom Lane wrote: Scott Bailey arta...@comcast.net writes: I'm trying to better understand the internals of Postgres, and I'm looking at the enum type. The docs say that an enum value is stored on disk as 4 bytes. But enum_send() returns a bytea representing the actual text of the value

Re: [GENERAL] Absolute value of intervals

2009-10-30 Thread Scott Bailey
My personal feeling is that when you provide any ordering operator and negation you can easily provide an absolute value operator. We've already (somewhat arbitrarily) decided that one of '1month -30days' and '-1month 30days) is greater than the other, so why not provide an operator that

Re: [GENERAL] Absolute value of intervals

2009-10-29 Thread Scott Bailey
. But there is some ambiguity around the length of a month. So INTERVAL '1 month - 30 days' = INTERVAL '0 days' = INTERVAL '-1 month +30 days'. But when added to a date, it makes no change for months with 30 days, adds 1 day for months with 31 days and subtracts 2 days for February. Scott Bailey

Re: [GENERAL] Absolute value of intervals

2009-10-27 Thread Scott Bailey
. But we've got two projects that implement a period data type, pgTemporal and Chronos. http://pgfoundry.org/projects/temporal/ http://pgfoundry.org/projects/timespan/ Scott Bailey -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] how to identify outliers

2009-10-27 Thread Scott Bailey
) AS old_dev FROM base, stats WHERE base.i BETWEEN stats.dist_avg - dist_dev AND stats.dist_avg + dist_dev Scott Bailey -- 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] cast numeric with scale and precision to numeric plain

2009-10-21 Thread Scott Bailey
Sim Zacks wrote: I'm using 8.2.4 Numeric with scale precision always shows the trailing zeros. Numeric plain only shows numbers after the decimal point that are being used. I would like to have the data in my table with scale and precision, but my views to be cast to numeric without any

Re: [GENERAL] Craeteing sparse arrays

2009-10-15 Thread Scott Bailey
be better off using hstore instead of straight arrays. http://www.postgresql.org/docs/8.4/interactive/hstore.html Scott Bailey -- 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] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi all! I have an interesting problem here that I think could be of interest to everyone. I in the process of writing test cases for our applications and there is one problem I am facing. To be able to test correctly, I need to create a small database (a sample if you want)

Re: [GENERAL] Tips/Hacks to create minial DB from the execution of several (simple) SQL requests.

2009-10-08 Thread Scott Bailey
Daniel Shane wrote: Hi Scott! The problem is that my test database has several tables with many links between them, so I have no idea which 1000 rows to get from which table. The only thing I can do is run the program that connects to that database and tell it to run on a sample of the

Re: Re[GENERAL] sources for learning PostgreSQL

2009-09-22 Thread Scott Bailey
://www.xach.com/aolserver/mysql-to-postgresql.html Scott Bailey -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: Re[GENERAL] petitive fields

2009-09-18 Thread Scott Bailey
manually. You should be able to write a function in a few minutes that walks a cursor and adds them to each table in a given schema. Scott Bailey -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql

Re: [GENERAL] haversine formula with postgreSQL

2009-09-18 Thread Scott Bailey
And I think that might work for you. The performance is going to be miserable for large stat sets, because it's going to scan the whole aaafacilities table every time and recompute every distance, but as an example goes it's probably acceptable. Something I did when implementing haversine in

Re: [GENERAL] Current state of XML capabilities in PostgreSQL?

2009-09-16 Thread Scott Bailey
I'm looking for the current state of XML capabilities in PostgreSQL and I'm coming up with a lot of confusing links and a bit short on documentation. Postgres' XML is still lacking in a few spots. But the core functionality is certainly there to do all of the every day stuff. The trick

[GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Scott Bailey
If I've got a function (sql or plpgsql) that takes anyelement as a param, how do I determine the type name or oid that was actually passed in? I figure there is probably a function for this but darn if I can find it. Specifically, I'm trying to make a function like Oracle's dump that will

Re: [GENERAL] Getting the oid of an anyelement

2009-09-10 Thread Scott Bailey
please, try to look on function pg_typeof Thanks Pavel. Just what I needed. But you're too late on the orafce recommendation. I had already written it by the time you posted. I would have written it any way though because Tom said I couldn't :) You would need to write that in C. Two

Re: [GENERAL] Import data from XML file

2009-08-26 Thread Scott Bailey
Hi! How do you import data from an xml-file? For instance, if I have a file like this: ?xml version=1.0 encoding=utf-8? p_update main_categories main_category main_category_nameSonstiges/main_category_name main_category_id5/main_category_id /main_category

Re: [GENERAL] pl/pgsql loop thru columns names

2009-08-21 Thread Scott Bailey
Dilyan Berkovski wrote: Hi All, I have a nasty table with many repeating columns of the kind port_ts_{i}_something, where {i} is from 0 to 31, and something could be 3 different words. I have made a pl/pgsql function that checks those columns from port_ts_1_status to port_ts_31_status and

Re: [GENERAL] join from array or cursor

2009-08-20 Thread Scott Bailey
John DeSoi wrote: Suppose I have an integer array (or cursor with one integer column) which represents primary keys of some table. Is there a simple and efficient way to return the rows of the table corresponding to the primary key values and keep them in the same order as the array (or

Re: [GENERAL] Looping through string constants

2009-08-13 Thread Scott Bailey
On Wed, Aug 12, 2009 at 08:45:58PM -0700, Scott Bailey wrote: CREATE OR REPLACE FUNCTION unnest(anyarray) RETURNS SETOF anyelement AS $BODY$ SELECT $1[i] FROM generate_series(array_lower($1,1), array_upper($1,1)) i; $BODY$ LANGUAGE 'sql' IMMUTABLE STRICT I'd

Re: [GENERAL] array syntax and geometric type syntax

2009-08-13 Thread Scott Bailey
I am trying to make sense of geometric literal syntax in and out of array syntax. I cannot figure out a general rule: sometimes single quotes work, sometimes double quotes work, and inside and outside of array literals the rules are different an seemingly inconsistent. Examples of all the

Re: [GENERAL] Looping through string constants

2009-08-12 Thread Scott Bailey
Using arrays makes it a little less verbose and easier to manage IMO. SELECT v FROM unnest(array['a','b','c','d']) v Is that 8.4? or is unnest from contrib/ ? thanks! Dave Unnest is included in 8.4, but it's pretty much essential for working with arrays. Pre 8.4, you'd add the function

Re: [GENERAL] [Q] parsing out String array

2009-08-12 Thread Scott Bailey
V S P wrote: if I have field declared myvalue text[][] insert into vladik (myval) values ( '{{\,A, \B}, {Y, Q}}' ) What do you guys use in your treasurechest of 'addons' to successfully parse out the above trickery and get and get the 4 strings ,A B Y Q from within Postgres stored procedure

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Roy Walter wrote: In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The documentation states:

Re: [GENERAL] Postgresql databases as a web service

2009-07-12 Thread Scott Bailey
Scott Marlowe wrote: On Sun, Jul 12, 2009 at 9:20 AM, dkeeneydvkee...@gmail.com wrote: Rdbhost.com offers SQL databases as a web service, running Postgresql 8.3.3 . Create a database on our server, execute queries against it in SQL via http request, and receive results as XML or JSON. There

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]): ERROR

Re: [GENERAL] Overhead of union versus union all

2009-07-09 Thread Scott Bailey
Alvaro Herrera wrote: Tim Keitt wrote: I am combining query results that I know are disjoint. I'm wondering how much overhead there is in calling union versus union all. (Just curious really; I can't see a reason not to use union all.) UNION needs to uniquify the output, for which it plasters

Re: [GENERAL] ubuntu packages for 8.4

2009-07-09 Thread Scott Bailey
Tim Uckun wrote: I don't see any ubuntu packages for 8.4 in the default repositories. Does anybody know if they will be upgrading the postgresql package to 8.4 or creating a new package for it. I'd rather use the packages than to compile it myself. If anybody has an argument as to why I should

Re: [GENERAL] = Null is Null?

2009-07-08 Thread Scott Bailey
Some DB's say that an empty string is the same as null, it doesn't mean they're right. In fact, it can be rather inconvenient if an empty string in your data also has a meaning (namely 'known to be an empty string' instead of 'unknown')! This is the behavior in Oracle. And I found that out

Re: [GENERAL] Installing plpython on 8.4

2009-07-03 Thread Scott Bailey
Peter Eisentraut wrote: On Friday 03 July 2009 06:09:37 Scott Bailey wrote: I'm having trouble installing plpython in 8.4. I tried under Windows (one click installer from EDB) and under Ubuntu (linux binary). In both cases I was told: could not load library 8.4/lib/postgresql/plpython.(so|dll

[GENERAL] Installing plpython on 8.4

2009-07-02 Thread Scott Bailey
I'm having trouble installing plpython in 8.4. I tried under Windows (one click installer from EDB) and under Ubuntu (linux binary). In both cases I was told: could not load library 8.4/lib/postgresql/plpython.(so|dll) Both systems have python 2.5 installed. And plpython was working in 8.3

Re: [GENERAL] Custom runtime variables

2009-06-26 Thread Scott Bailey
Scott Bailey arta...@comcast.net writes: I added the following lines to my postgresql.conf file: custom_variable_classes = 'foo' foo.name = '1s' Now if I do show foo.name I get '1s' But it does not show up in show all or in pg_settings. No, it doesn't. It should still work in set/show

[GENERAL] Custom runtime variables

2009-06-25 Thread Scott Bailey
I want to be able to change the behavior of some functions based on custom runtime variables. I added the following lines to my postgresql.conf file: custom_variable_classes = 'foo' foo.name = '1s' Now if I do show foo.name I get '1s' But it does not show up in show all or in pg_settings. I

[GENERAL] Naming functions with reserved words

2009-06-17 Thread Scott Bailey
I noticed in the temporal project they used reserved words for their functions (union, intersect, etc) But when I try to create a function like that I get an error and I have to quote it both when creating the function and when calling it. The only difference I can see is they their functions

Re: [GENERAL] timestamp no fractional seconds

2009-06-02 Thread Scott Bailey
Grzegorz Jaśkiewicz wrote: what difference does the (0) make than ? is timestamp() a function than ?/ The (0) is setting the precision. Telling it to store 0 places for the fractional second. Much like setting scale and precision with numeric(6,2) Scott -- Sent via pgsql-general mailing

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Scott Bailey
Pavel Stehule wrote: 2009/6/1 Grzegorz Jaśkiewicz gryz...@gmail.com: That's one of things pg xml type lacks ... :/ yes - SQL/XML isn't completed yet http://wiki.postgresql.org/wiki/XML_Support :( I believe so some procedure like xml_to_table should be nice. but plperlu code should be

Re: [GENERAL] ruby connect

2009-06-01 Thread Scott Bailey
I’m trying to connect ruby to postgres on ubuntu and the only link I found that has the library is down. Does anyone have the postgres library for ruby? Or direct me to it? Yeah, I think this is an area that we need to address if we want to see wider adoption of Postgres. I started out to

Re: [GENERAL] Switching databases over JDBC/ODBC

2009-05-30 Thread Scott Bailey
John R Pierce wrote: Scott Bailey wrote: Well at work we've got Oracle, MySQL, MS SQL and Postgres. So I generally use Aqua Data Studio because it works with all of them. For MySQL and MS SQL you register a single connection to the server and can switch to any database. But with Postgres, you

Re: [GENERAL] composite type and domain

2009-05-29 Thread Scott Bailey
Grzegorz Jaśkiewicz wrote: On Fri, May 29, 2009 at 3:37 AM, Scott Bailey arta...@comcast.net wrote: Did you read the article I sent you earlier? Well, the difference here is that this way db doesn't really check anything :) you just choose path of execution, that you created prior. That's

[GENERAL] Switching databases over JDBC/ODBC

2009-05-29 Thread Scott Bailey
Is there an equivalent to psql's \connect database or MySQL/MS SQL's use database command that will work with JDBC? It doesn't seem like I should need to drop the connection and establish a new one just to switch databases. Scott -- Sent via pgsql-general mailing list

Re: [GENERAL] Switching databases over JDBC/ODBC

2009-05-29 Thread Scott Bailey
John R Pierce wrote: Scott Bailey wrote: Is there an equivalent to psql's \connect database or MySQL/MS SQL's use database command that will work with JDBC? It doesn't seem like I should need to drop the connection and establish a new one just to switch databases. the \connect command

Re: [GENERAL] composite type and domain

2009-05-28 Thread Scott Bailey
Grzegorz Jaśkiewicz wrote: 2009/5/27 Scott Bailey arta...@comcast.net: Who said anything about the application level? can you give an example please ? Did you read the article I sent you earlier? I'm doing almost the exact same thing you are doing save the bytea field. I create

Re: [GENERAL] composite type and domain

2009-05-27 Thread Scott Bailey
Grzegorz Jaśkiewicz wrote: Why is it not possible to create domain on composite type ? Consider the example, I got (a bytea, b timestamp, c timestamp). Where b c always, and both b and c have some default value, a can stay null. Now, I don't want to go berserk, and create aditional table for

Re: [GENERAL] composite type and domain

2009-05-27 Thread Scott Bailey
Scott Bailey wrote: Grzegorz Jaśkiewicz wrote: Why is it not possible to create domain on composite type ? Consider the example, I got (a bytea, b timestamp, c timestamp). Where b c always, and both b and c have some default value, a can stay null. Now, I don't want to go berserk, and create

Re: [GENERAL] composite type and domain

2009-05-27 Thread Scott Bailey
Grzegorz Jaśkiewicz wrote: well, I need database to guard data, not application. Application can check things too, but database's job is to make sure data is integral. Who said anything about the application level? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] referring to calculated column in sub select

2009-05-22 Thread Scott Bailey
Hi, why column acoltest is not found by the subselect in this select: SELECT acol + 100 as acoltest, (select max(t) from mytab where anothercol=acoltest) as col2 FROM mytab2 group by somet ??? Only columns belonging to a table can be used in a subselect??? What about calculated

[GENERAL] Passing tokens to a function

2009-05-22 Thread Scott Bailey
I'd like to make an XMLTABLE() function, probably in plpython (not C). And I'd like to follow the SQL/XML standard. So a function call should look something like this: SELECT * FROM XMLTABLE('//node' PASSING xmldoc COLUMNS id INT PATH '@id', name VARCHAR(30) PATH 'name') Is this

Re: [GENERAL] INTERVAL SECOND limited to 59 seconds?

2009-05-20 Thread Scott Bailey
Sebastien FLAESCH wrote: Actually it's not limited to the usage of INTERVAL SECOND, I am writing a PostgreSQL driver for our 4GL virtual machine... I need to store all possible Informix INTERVAL types such as: INTERVAL MONTH(8) TO MONTH INTERVAL DAY(8) TO MINUTE INTERVAL SECOND TO