Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 07:47 PM
Bruce Momjian
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string escapeing

> Does anyone know if it will be possible to run the server with ANSI/ISO
> string escaping instead of C-style escapes? The C style escaping is a
> shoot-down for our adoption of postgres, since its non-standard.
>
>
> Not yet, but we have a TODO item:
>
> * Allow backslash handling in quoted strings to be disabled for
> portability
>
> The use of C-style backslashes (.e.g. \n, \r) in quoted strings is not
> SQL-spec compliant, so allow such handling to be disabled.
>
> Uh, what is ANSI/ISO escaping actually? I assume you mean only supporting
> '' for literal quotes rather than \' too.
>
> Yes Sir. Being able to disable the backslash-escaping is the desired
> operation. In circles of business deciding wether to move to opensource
> databases this is the silently used excuse (by the critics) to dismiss
> pg since its arguably so fundamental and somewhat dangerous (data loss).
> Getting pg to behave 'normally' would silence this excuse. Is there
> anything I can do to help move this up the todo list?


Uh, yea, this is going to require quite a bit of discussion in the
group, and I am concerned how it will affect other apps using
PostgreSQL. (The mode isn't going to be useful if it breaks plug-in
extensions and stuff.)

I think COPY is always going to need to use backslashes. There is no
other good way to handle special characters and stuff, but I don't see
people complaining that has to be portable.

I think most of it is done in parser/scan.l if you want to hack in there
and get a test implementation working and send in a patch. We can work
on the infrastructure to turn it on and off.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 07:47 PM
Tom Lane
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string escapeing

Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Does anyone know if it will be possible to run the server with ANSI/ISO
>> string escaping instead of C-style escapes? The C style escaping is a
>> shoot-down for our adoption of postgres, since its non-standard.


> Uh, yea, this is going to require quite a bit of discussion in the
> group, and I am concerned how it will affect other apps using
> PostgreSQL. (The mode isn't going to be useful if it breaks plug-in
> extensions and stuff.)


The hard part of this isn't turning off backslash quoting; the code
changes to do that would be pretty trivial. The hard part is not
breaking vast quantities of existing client code. After our experience
with autocommit, no one is going to want to solve it with a GUC variable
that can be flipped on and off at random. That would make the
compatibility problems that autocommit caused look like a day at the
beach :-(

I don't actually know a way to solve this that wouldn't impose
impossible amounts of pain on our existing users, and I'm afraid that
I rank that consideration higher than acquiring new users who won't
consider changing their own code.

If you can show me a way to provide this behavior without risk of
breaking existing code, I'm all ears.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 07:48 PM
Ken Johanson
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string escapeing


>>Uh, yea, this is going to require quite a bit of discussion in the
>>group, and I am concerned how it will affect other apps using
>>PostgreSQL. (The mode isn't going to be useful if it breaks plug-in
>>extensions and stuff.)
>>
>>

>
>The hard part of this isn't turning off backslash quoting; the code
>changes to do that would be pretty trivial. The hard part is not
>breaking vast quantities of existing client code. After our experience
>with autocommit, no one is going to want to solve it with a GUC variable
>that can be flipped on and off at random. That would make the
>compatibility problems that autocommit caused look like a day at the
>beach :-(
>
>I don't actually know a way to solve this that wouldn't impose
>impossible amounts of pain on our existing users, and I'm afraid that
>I rank that consideration higher than acquiring new users who won't
>consider changing their own code.
>
>If you can show me a way to provide this behavior without risk of
>breaking existing code, I'm all ears.
>
> regards, tom lane
>
>

I feel somewhat confident (very actually) that a config option that
disabled the backslash behavior globally(*) would be acceptable, BUT
leave the current backslash behavior turned on by default so that
current users are not impacted at all. Only a conscientious decision by
the db admin to turn it on could cause problems, but _only_ if he/she
didn't warn all his/her users beforehand of the impending change and its
consequences (rtm).

(*Or if it's possible, provide the no-backslash config on a per-catalog
basis perhaps? -or even per-user/group?, --that would allow individuals
to use the legacy mode until they choose otherwise)

I can say, that I for one would enable the no-backslash config option
out of the box -globally -so that we can start using pg now without any
more upper managerial concerns/excuses about language/interface
compliance..I can also say that (what we already know) the longer we
wait to provide the 'right' option, the *more* legacy apps (and
interfaces) will be built around it and consequently suffer when the
need for change eventually comes (almost wholly caused by interop
concerns). And market gain is being hurt now by this incompatibility
with commercial offerings; that's an unfortunate fact.

Better to nip it in the bud sooner than later, imo.

thoughts,
ken



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 07:49 PM
Jeff Davis
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string

On Sun, 2005-02-27 at 18:25 -0700, Ken Johanson wrote:
> >>Uh, yea, this is going to require quite a bit of discussion in the
> >>group, and I am concerned how it will affect other apps using
> >>PostgreSQL. (The mode isn't going to be useful if it breaks plug-in
> >>extensions and stuff.)
> >>
> >>

> >
> >The hard part of this isn't turning off backslash quoting; the code
> >changes to do that would be pretty trivial. The hard part is not
> >breaking vast quantities of existing client code. After our experience
> >with autocommit, no one is going to want to solve it with a GUC variable
> >that can be flipped on and off at random. That would make the
> >compatibility problems that autocommit caused look like a day at the
> >beach :-(
> >
> >I don't actually know a way to solve this that wouldn't impose
> >impossible amounts of pain on our existing users, and I'm afraid that
> >I rank that consideration higher than acquiring new users who won't
> >consider changing their own code.
> >
> >If you can show me a way to provide this behavior without risk of
> >breaking existing code, I'm all ears.
> >
> > regards, tom lane
> >
> >

> I feel somewhat confident (very actually) that a config option that
> disabled the backslash behavior globally(*) would be acceptable, BUT
> leave the current backslash behavior turned on by default so that
> current users are not impacted at all. Only a conscientious decision by
> the db admin to turn it on could cause problems, but _only_ if he/she
> didn't warn all his/her users beforehand of the impending change and its
> consequences (rtm).
>


I'm a little worried about PostgreSQL having the same problems as PHP.
In PHP, every time you want to download an application, you never see
"This application works on php 4+". Instead, you see "This application
works on php4+ with the following config options set <long list>".
Sometimes these applications have conflicting requirements. From an
administrator's standpoint, it's a mess.

In PostgreSQL I think it would actually be much worse. Right now many
applications build a PostgreSQL layer, but will they build two? I think
this would cause a divide in the application support (some for config
option A some for config option B) in the already smaller-than-we'd-like
set of software that supports PostgreSQL.

Regards,
Jeff Davis




---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 07:49 PM
Ken Johanson
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string


>I'm a little worried about PostgreSQL having the same problems as PHP.
>In PHP, every time you want to download an application, you never see
>"This application works on php 4+". Instead, you see "This application
>works on php4+ with the following config options set <long list>".
>Sometimes these applications have conflicting requirements. From an
>administrator's standpoint, it's a mess.
>
>In PostgreSQL I think it would actually be much worse. Right now many
>applications build a PostgreSQL layer, but will they build two? I think
>this would cause a divide in the application support (some for config
>option A some for config option B) in the already smaller-than-we'd-like
>set of software that supports PostgreSQL.
>
>Regards,
> Jeff Davis
>
>

There's certainly two perspectives to this. The one you present is
certainly valid, but consider the bigger picture...

"This application requires the following databases: Oracle versionX, MY
SQL version X, Mysql version 5.2 with the no-backslashes option, UltraDB
version x"

Notice the lack of PG - some apps - most notably commercial ones - will
automatically shoot it down if it cant meet certain language
requirements. The database itself could meet the latest SQL03 (or
whatever we're up to) specs for Object Relational stuff, etc to the tee.
The JDBC driver could meet the JDBC spec to the tee for transaction
support, etc - but this one low level problem is a total show stopper,
because it plainly breaks queries sent through various interfaces in
various drivers.

Besides, the version-deprecation / version requirements you mention
exists in every piece of software I've even seen. Sometime they're okay
with a really old version, sometime only the newest will do. This is the
very argument for getting PG to offer an (use-optional) escape behavior
inline with the rest - to mitigate these version requirements down the road.

Thoughts,
ken



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 07:49 PM
Martijn van Oosterhout
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string escapeing

On Sun, Feb 27, 2005 at 06:25:18PM -0700, Ken Johanson wrote:
> I feel somewhat confident (very actually) that a config option that
> disabled the backslash behavior globally(*) would be acceptable, BUT
> leave the current backslash behavior turned on by default so that
> current users are not impacted at all. Only a conscientious decision by
> the db admin to turn it on could cause problems, but _only_ if he/she
> didn't warn all his/her users beforehand of the impending change and its
> consequences (rtm).


It's not just a question of warning the users, all interfaces to the
database will instantly break. For example: JDBC, Perl DBI, PHP PEAR
etc. They will continue to send queries with the backslashes embedded.
These interfaces would need to be modified to handle both situations
and detect which situation they're dealing with.

The thing is all these interfaces handle the quoting transparently for
you, so the code is portable already. What you're complaining about is
that you have your own query marshalling and it is not portable.

Incidently, if you disable the backslash quoting, how does one enter
raw binary data including NUL (\0) characters?

The only viable solution I can think of is that it is set at
*connection* time (maybe extra parameters), and unchangable for the
rest of the session. This means that unmodified client interfaces won't
see a difference.

> I can say, that I for one would enable the no-backslash config option
> out of the box -globally -so that we can start using pg now without any
> more upper managerial concerns/excuses about language/interface
> compliance..I can also say that (what we already know) the longer we
> wait to provide the 'right' option, the *more* legacy apps (and
> interfaces) will be built around it and consequently suffer when the
> need for change eventually comes (almost wholly caused by interop
> concerns). And market gain is being hurt now by this incompatibility
> with commercial offerings; that's an unfortunate fact.


Even if PostgreSQL implements this now, you will have to wait for new
versions of any client libraries before it's usable. See the autocommit
disaster for an example why people are not rushing into this...

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFCIuF9Y5Twig3Ge+YRAkI8AJ97gHc6OWjrKav3kGfCew DtqVTlcQCgmpw2
IIbWZUrG80OTJ8s0ydS2ojI=
=jjsh
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-08-2008, 07:49 PM
Bruno Wolff III
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string

On Mon, Feb 28, 2005 at 10:13:00 -0700,
Ken Johanson <pg-user@kensystem.com> wrote:
>
> Besides, the version-deprecation / version requirements you mention
> exists in every piece of software I've even seen. Sometime they're okay
> with a really old version, sometime only the newest will do. This is the
> very argument for getting PG to offer an (use-optional) escape behavior
> inline with the rest - to mitigate these version requirements down the road.


Shouldn't this data be being passed through some standard code that checks if
escaping is needed? If so, is that the right place to handle whether or not
backslashes need to be escaped in addition to single quotes?

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-08-2008, 07:49 PM
Ken Johanson
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string

Bruno Wolff III wrote:
> On Mon, Feb 28, 2005 at 10:13:00 -0700,
> Ken Johanson <pg-user@kensystem.com> wrote:
>
>>Besides, the version-deprecation / version requirements you mention
>>exists in every piece of software I've even seen. Sometime they're okay
>>with a really old version, sometime only the newest will do. This is the
>>very argument for getting PG to offer an (use-optional) escape behavior
>>inline with the rest - to mitigate these version requirements down the road.

>
>
> Shouldn't this data be being passed through some standard code that checks if
> escaping is needed? If so, is that the right place to handle whether or not
> backslashes need to be escaped in addition to single quotes?
>
>
>


Ideally yes, but its not a requirement in any driver's spec that I'm
familiar with. In fact the driver specs expect or 'claim' some (possibly
implicit) level of sql language compliance -- so that the same query
sent to a different database yields the same result.

insert into tbl (path) values ('c:\test')

The above query *could* and "should* be sent through an escape
preprocessor (PreparedStatement interface) but it is *not* required.
It's also not fair to say that a user can *expect* the above to not work
with PG even though it does with another DB, imo. The user coming from
another DB *won't* expect it to be broken. (I know from experience :-)



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-08-2008, 07:49 PM
Peter Eisentraut
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string escapeing

Martijn van Oosterhout wrote:
> Incidently, if you disable the backslash quoting, how does one enter
> raw binary data including NUL (\0) characters?


The bytea type has its own internal quoting/escaping mechanism (which
overlaps with the lexer's mechanism in some ways), so entering binary
data is not an issue.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-08-2008, 07:50 PM
Jeff Davis
 
Posts: n/a
Default Re: Possible to run the server with ANSI/ISO string

On Mon, 2005-02-28 at 10:13 -0700, Ken Johanson wrote:
> >I'm a little worried about PostgreSQL having the same problems as PHP.
> >In PHP, every time you want to download an application, you never see
> >"This application works on php 4+". Instead, you see "This application
> >works on php4+ with the following config options set <long list>".
> >Sometimes these applications have conflicting requirements. From an
> >administrator's standpoint, it's a mess.
> >
> >In PostgreSQL I think it would actually be much worse. Right now many
> >applications build a PostgreSQL layer, but will they build two? I think
> >this would cause a divide in the application support (some for config
> >option A some for config option B) in the already smaller-than-we'd-like
> >set of software that supports PostgreSQL.
> >
> >Regards,
> > Jeff Davis
> >
> >

> There's certainly two perspectives to this. The one you present is
> certainly valid, but consider the bigger picture...
>
> "This application requires the following databases: Oracle versionX, MY
> SQL version X, Mysql version 5.2 with the no-backslashes option, UltraDB
> version x"
>
> Notice the lack of PG -

[snip]

A valid point: that's certainly the issue we're dealing with here.

I think most people agree that being SQL compliant is good. The question
is: is it worth the pain for existing users?

A configurable option does not make the pain disappear. Admins are
forced to choose one side (either sql compliant or c style) and exclude
the other applications. Any app developer that wants to support pre-8.1
apps will have to have a c-style app available. So even if you nip it in
the bud, it's not really gone yet because app developers want to support
old versions of postgres.

I know if we added the option and deprecated the old style, I would be
forced to choose between using deprecated syntax that may not be
supported for long, or doing a lot of work to convert and retest
applications.

> Besides, the version-deprecation / version requirements you mention
> exists in every piece of software I've even seen. Sometime they're okay
> with a really old version, sometime only the newest will do. This is the
> very argument for getting PG to offer an (use-optional) escape behavior
> inline with the rest - to mitigate these version requirements down the road.



I think you may have misunderstood what I meant. I am not suggesting
that we don't change the database at all between versions, my argument
was showing the difficulties when one version has many different shapes
due to many incompatible options.

Regards,
Jeff Davis


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440