Re: [SQL] Request for builtin function: Double_quote

2002-06-18 Thread Christoph Haller

Josh, 
I'm not sure what you mean by 'builtin C function'. 
There is one already 
 size_t PQescapeString (char *to, const char *from, size_t length); 
Or do you mean a String Function like 
 substring(string [from integer] [for integer]) 
I would rather call it 'builtin sql function'. 

Regards, Christoph 

> 
> Folks,
> 
> Given the amount of qoute nesting we do in Postgres, I thought that we need a
> function that handles automatic doubling of quotes within strings.   I've 
> written one in PL/pgSQL (below).  I'd really love to see this turned into a 
> builtin C function.
> 
> -Josh
> 

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [SQL] Limiting database size

2002-06-18 Thread Ulrich Sprick

Hi Mauricio

Novell, and i think windows and unix as well, have the disk quota feature.
The disk size assigned to a user can be limited. There should also be
warning levels in order to get the sysadmin noticed about a user running out
of space before it's too late. Try on a os related newsgroup, they should
know better!

ulli

"MaurĂ­cio Sessue Otta" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:005a01c20e57$3dbdfcc0$[EMAIL PROTECTED]...
> This is a multi-part message in MIME format.
>
> --=_NextPart_000_0057_01C20E3E.0C7EE840
> Content-Type: text/plain; charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Hi,  is there any way to limit the database size??
>
> []'s Mauricio




---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[SQL] function text_ge(text, text), how to use on version 7.2

2002-06-18 Thread juerg . rietmann

Hello there

I use the function text_ge(text, text) under version 7.03 and it was just
fine. After upgrading to version 7.2 this function doesn't work anymore.

this statement shows all the records even if the greatest year is 2002 in
ul_datum :
select * from userlog where text_ge(ul_datum, '01.01.2004')

Thanks in advance ... Juerg Rietmann



__

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet  :  www.pup.ch
phone   : +4141 790 4040
fax : +4141 790 2545
mobile: +4179 211 0315
__



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [SQL] function text_ge(text, text), how to use on version 7.2

2002-06-18 Thread Achilleus Mantzios

On Tue, 18 Jun 2002 [EMAIL PROTECTED] wrote:

> Hello there
> 
> I use the function text_ge(text, text) under version 7.03 and it was just
> fine. After upgrading to version 7.2 this function doesn't work anymore.

It is quite possible that text_ge uses local encodings.
However I think it is working fine, but it is unwise to use strings
for dates representation.

You could use timestamps with resolution to milisecond
(which means storing actual UNIX dates), or dates.

What you do with text_ge is a lexicographical comparison of the two texts.
Hence, this method will produce different results for different encodings,
and thus it is not portable.

i'd say convert the 'DD-MM-' ul_datum fields with the correct SQL 
dates, or timestamps, and then use normal date comparison <,>,=.

> 
> this statement shows all the records even if the greatest year is 2002 in
> ul_datum :
> select * from userlog where text_ge(ul_datum, '01.01.2004')
> 
> Thanks in advance ... Juerg Rietmann
> 
> 
> 
> __
> 
> PFISTER + PARTNER, SYSTEM - ENGINEERING AG
> Juerg Rietmann
> Grundstrasse 22a
> 6343 Rotkreuz
> Switzerland
> 
> internet  :  www.pup.ch
> phone   : +4141 790 4040
> fax : +4141 790 2545
> mobile: +4179 211 0315
> __
> 
> 
> 
> ---(end of broadcast)---
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:+30-10-8981112
fax:+30-10-8981877
email:  [EMAIL PROTECTED]
[EMAIL PROTECTED]


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [SQL] Request for builtin function: Double_quote

2002-06-18 Thread Tom Lane

Josh Berkus <[EMAIL PROTECTED]> writes:
> Given the amount of qoute nesting we do in Postgres, I thought that we need a 
> function that handles automatic doubling of quotes within strings.   I've 
> written one in PL/pgSQL (below).  I'd really love to see this turned into a 
> builtin C function.

What does this do that isn't already done by quote_literal?

regards, tom lane

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [SQL] Users

2002-06-18 Thread Bruno Wolff III

On Tue, Jun 18, 2002 at 00:46:59 +0100,
  Andy Pearce <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> This may be the wrong forum, but I'm sure someone can help!
> 
> I'm writing a VB application that uses PostgreSQL as the database backend. Is it 
>common practice to create a user id in pgsql for each user of the system or can I 
>create one user id in pgsql and configure users within the application using info 
>from a table in the database? 
> 
> The reason I'm asking is that either way I need to create the table in the database 
>to decide what privileges each user will have, that will affect the application not 
>the database.

Depend on what your access rules are you may be able to implement the
rules using views. Then they would be enforced by the database.

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] Request for builtin function: Double_quote

2002-06-18 Thread Josh Berkus

Chris, Tom:

Yes, thank you Chris, I meant a builtin SQL function.

> > Given the amount of qoute nesting we do in Postgres, I thought that
> we need a 
> > function that handles automatic doubling of quotes within strings.
>   I've 
> > written one in PL/pgSQL (below).  I'd really love to see this
> turned into a 
> > builtin C function.
> 
> What does this do that isn't already done by quote_literal?

Well, first off, quote_literal isn't in the documentation under
"Functions and Operators".So this is the first I've heard about it
-- or probably anyone else outside the core team.   How long has it
been around?

Second, double_quote does not return the outside quotes, just the
inside ones ... it's for passing string values to EXECUTE statements.
  However, now that I know that quote_literal exists, I can simplify
the double_quote statement considerably.  

Therefore, I withdraw my initial request, and request instead that
quote_literal be added to the function documentation in String
Functions and Operators.

I will event supply text for the functions table:

functionreturns 
quote_literal(string text)  text

explain
Returns the entire string passed to it, including quote marks.  Useful
for nesting quotes, such as in the EXECUTEing dynamic queries.

example result
quote_literal('O''Reilly')  'O''Reilly'


-Josh Berkus

-Josh Berkus

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[SQL] text vs varchar

2002-06-18 Thread Wei Weng

Is there any disadvantage of using TEXT datatype as opposed to a VARCHAR
datatype with a maximum length, especially when I do searches on them?

Thanks


-- 
Wei Weng
Network Software Engineer
KenCast Inc.



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [SQL] text vs varchar

2002-06-18 Thread Josh Berkus

Wei,

> Is there any disadvantage of using TEXT datatype as opposed to a VARCHAR
> datatype with a maximum length, especially when I do searches on them?

Yes.  You can't index TEXT because it's of potentially unlimited length.

-- 
-Josh Berkus


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [SQL] text vs varchar

2002-06-18 Thread Michelle Murrain

On Tue, 2002-06-18 at 18:07, Wei Weng wrote:
> Is there any disadvantage of using TEXT datatype as opposed to a VARCHAR
> datatype with a maximum length, especially when I do searches on them?

There is one big disadvantage that I've found, but might be utterly
unimportant to you. Some applications (particularly Crystal Reports) do
not like unbounded text fields, and make it quite difficult to do any
manipulations of them. This might be an odbc issue, rather than an
application issue, but it can be a big deal sometimes.

-- 
.Michelle
--
Michelle Murrain, Technology Consulting
[EMAIL PROTECTED] http://www.murrain.net

413-253-2874
413-222-6350 cell
413-825-0288 fax


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] text vs varchar

2002-06-18 Thread Wei Weng

On Tue, 2002-06-18 at 18:59, Josh Berkus wrote:
> Wei,
> 
> > Is there any disadvantage of using TEXT datatype as opposed to a VARCHAR
> > datatype with a maximum length, especially when I do searches on them?
> 
> Yes.  You can't index TEXT because it's of potentially unlimited length.
> 
> -- 
> -Josh Berkus
> 
> 
I noticed that it is a characteristics of MS SQL Server, but I did
successfully create unique index based on a TEXT field in Postgresql
7.2, while that failed in MS SQL Server (7).

Or do they behave the same in this aspect?

Thanks

-- 
Wei Weng
Network Software Engineer
KenCast Inc.



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] date_part

2002-06-18 Thread Josh Berkus

Rudi,

select to_char(date_column, 'Month');

See similar under "Formatting Function" in the docs.

-- 
-Josh Berkus


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [SQL] text vs varchar

2002-06-18 Thread Josh Goldberg

I have no trouble indexing TEXT datatype in postgres-7.x

- Original Message - 
From: "Josh Berkus" <[EMAIL PROTECTED]>
> Yes.  You can't index TEXT because it's of potentially unlimited length.



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])