Re: [SQL] enum data type vs table

2011-05-25 Thread Peter Koczan
On Tue, May 17, 2011 at 11:23 PM, Seb splu...@gmail.com wrote: Are there any guidelines for deciding whether to 1) create an enum data type or 2) create a table with the set of values and then have foreign keys referencing this table?  Some fields in a database take a small number of values,

Re: [SQL] Domains, casts, and MS Access

2010-08-17 Thread Peter Koczan
On Wed, Aug 4, 2010 at 8:49 PM, Richard Broersma richard.broer...@gmail.com wrote: On Wed, Aug 4, 2010 at 3:41 PM, Peter Koczan pjkoc...@gmail.com wrote: Yep, that's the stumbling block we're running into. ODBC and these fields' assumptions of true/false are at odds. I'm trying a few other

[SQL] Domains, casts, and MS Access

2010-08-04 Thread Peter Koczan
Hi all, I'm working on porting an old MS Access form application from Sybase to postgres/ODBC as part of a larger database port project. One of the snags that's popped up is that there's some incompatibility between data types. Specifically, many fields are the Sybase type bit, which is

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Peter Koczan
On Wed, Aug 4, 2010 at 12:47 PM, Richard Broersma richard.broer...@gmail.com wrote: On Wed, Aug 4, 2010 at 10:31 AM, Peter Koczan pjkoc...@gmail.com wrote: One of the snags that's popped up is that there's some incompatibility between data types. Specifically, many fields are the Sybase type

Re: [SQL] Domains, casts, and MS Access

2010-08-04 Thread Peter Koczan
On Wed, Aug 4, 2010 at 4:40 PM, Richard Broersma richard.broer...@gmail.com wrote: On Wed, Aug 4, 2010 at 1:24 PM, Justin Graf jus...@magwerks.com wrote: My memory is fuzzy but there are some additional settings in Access that allows data type mapping... My experience is that PostgreSQL

[SQL] tsearch2 and wildcards/pattern matching?

2010-07-07 Thread Peter Koczan
Hi all, Is there any sort of pattern matching or partial matching capability in tsearch2? I'd like to be able search for a common prefix (like for order numbers). For instance, tsearch2 will index 'zvt123456' or 'zvt55', but I'd like to be able to find both of them in one query using

Re: [SQL] tsearch2 and wildcards/pattern matching?

2010-07-07 Thread Peter Koczan
On Wed, Jul 7, 2010 at 5:44 PM, Oleg Bartunov o...@sai.msu.su wrote: it's called prefix search: =# select 'zvt123456'::tsvector @@ 'zvt:*';  ?column? --  t Ah, that works. Excellent. Thanks, Peter -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to

[SQL] ascii-betical sort order?

2009-05-08 Thread Peter Koczan
Is there some way to do ascii-betical sort ordering in postgres (i.e. capital letters come before lowercase)? It appears that text ordering is dictionary-alphabetical. It's useful, but it's different from the DBMS I'm porting some applications from (SQL Server, in case you were curious). It may

Re: [SQL] ascii-betical sort order?

2009-05-08 Thread Peter Koczan
On Fri, May 8, 2009 at 12:57 PM, Tom Lane t...@sss.pgh.pa.us wrote: You're apparently using a non-C locale ... you need to re-initdb in C locale. On Fri, May 8, 2009 at 12:58 PM, Kenneth Marshall k...@rice.edu wrote: Try looking under Localization in the manual (Chapter 22). Excellent, just

Re: [SQL] pl/pgsql or control structures outside of a function?

2009-04-06 Thread Peter Koczan
On Fri, Apr 3, 2009 at 11:28 PM, John DeSoi de...@pgedit.com wrote: Is there any way to use PL/pgSQL code outside of a function? No. I kinda figured, but it doesn't hurt to ask. The reason I'm asking is that I'm porting some code from sybase/isql/SQR, and it allows some control code

[SQL] pl/pgsql or control structures outside of a function?

2009-04-03 Thread Peter Koczan
Hi all, Is there any way to use PL/pgSQL code outside of a function? The reason I'm asking is that I'm porting some code from sybase/isql/SQR, and it allows some control code structures to be used in an sql script. For instance, begin if ((select count(*) from users where login = 'foo') = 0)

[SQL] New datestyle(s)

2009-02-16 Thread Peter Koczan
Anyway, this is in response to a really old request of mine to easily and automatically get a datestyle for a different DBMS as part of an ongoing port process (http://archives.postgresql.org/pgsql-sql/2008-05/msg00048.php). I patched this a while ago and I finally got a chance to test it.

[SQL] Auto-formatting timestamps?

2008-05-13 Thread Peter Koczan
Hi all, I'm undergoing a port from an old Sybase database to Postgres. It's going surprisingly well, but I have a question regarding formatting of timestamps. In Sybase, we get: : select date from checkoutdate; date 'May 1 2001 12:00AM' ... In Postgres: = select date from checkoutdate;