Re: [SQL] enum data type vs table

2011-05-25 Thread Peter Koczan
On Tue, May 17, 2011 at 11:23 PM, Seb 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, and I'm not sur

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

2010-08-17 Thread Peter Koczan
On Wed, Aug 4, 2010 at 8:49 PM, Richard Broersma wrote: > On Wed, Aug 4, 2010 at 3:41 PM, Peter Koczan 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 &

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

2010-08-04 Thread Peter Koczan
On Wed, Aug 4, 2010 at 4:40 PM, Richard Broersma wrote: > On Wed, Aug 4, 2010 at 1:24 PM, Justin Graf wrote: > >> My memory is fuzzy but there are some additional settings in Access that >> allows data type mapping... > > My experience is that PostgreSQL Integer types work the best for > MS-Acces

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

2010-08-04 Thread Peter Koczan
On Wed, Aug 4, 2010 at 12:47 PM, Richard Broersma wrote: > On Wed, Aug 4, 2010 at 10:31 AM, Peter Koczan 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 >> &

[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 basical

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

2010-07-07 Thread Peter Koczan
On Wed, Jul 7, 2010 at 5:44 PM, Oleg Bartunov 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 your subscript

[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 somethin

Re: [SQL] ascii-betical sort order?

2009-05-08 Thread Peter Koczan
On Fri, May 8, 2009 at 12:57 PM, Tom Lane 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 wrote: > Try looking under Localization in the manual (Chapter 22). Excellent, just what I was looking for. I'll l

[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 no

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 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 structures to be

[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. Overall

Re: [SQL] Auto-formatting timestamps?

2008-05-14 Thread Peter Koczan
On Tue, May 13, 2008 at 5:54 PM, Mag Gam <[EMAIL PROTECTED]> wrote: > Why not create a view? That's a possibility, but the issue is that the output formatting is bound to a data type (timestamp), not one or two particular tables. Trying to create a view for all the tables with timestamps (and crea

[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;