Discussion:
Different behaviour of syslogins in ASE 15 and ASE 12.5?
(too old to reply)
Heinz Müller
2009-02-20 17:51:33 UTC
Permalink
Hi,

I figured out a different behaviour if I create a login with more than 30 charaters as fullname, for example:

sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"

In ASE 12.5 the account is created but the fullname column cropped after 30 characters.

In ASE 15.0.2 the account isn't created at all.

Anyone know if this a feature of 15.0.2? Any parameters I can set to get the 12.5.x behaviour?

THX!

Heinz
Mark A. Parsons
2009-02-20 18:30:30 UTC
Permalink
I'm gonna assume you issued this command via some GUI ... because when I issue the command via isql I get:

====================
1> select @@version
2> go


---------------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.0.2/EBF 15963 ESD#6/P/NT (IX86)/Windows 2000/ase1502/2537/32-bit/OPT/Wed Oct 01 21:41:43
2008


1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
2> go

Msg 17240, Level 16, State 1:
Server 'HP2', Procedure 'sp_addlogin', Line 238:
'these are more than 30 characters I think' is not a valid name.
(return status = 1)
===================

If you're not getting an error via isql ... what's your ASE version?

------------------------------------------

In the meantime, a gander at the various bits-n-pieces shows:

- sp_addlogin input parameter '@fullname' is defined as varchar(255)

- sp_addlogin determines that the max length for the syslogins.fullname column is 30

- sp_addlogin makes a call to an undocumented version of valid_name() which in this case causes the generation of the
'Msg 17240' (ie, the input string is > 30 characters in length)

- syslogins.fullname is still defined as varchar(30) (at least in my ASE version)

Sooooo, it looks like the sp_addlogin/@fullname variable has been improperly declared as varchar(255). Did you find
documentation somewhere stating that @fullname could be more than 30 characters? (if so then obviously (?) there's a
bug in the documentation, eh
Post by Heinz Müller
Hi,
sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
In ASE 12.5 the account is created but the fullname column cropped after 30 characters.
In ASE 15.0.2 the account isn't created at all.
Anyone know if this a feature of 15.0.2? Any parameters I can set to get the 12.5.x behaviour?
THX!
Heinz
Heinz Müller
2009-02-20 18:52:05 UTC
Permalink
Mark,

I'm not in my office now. Monday again!

We noticed the problem first with a special delivered stored procedure for user referencing
after loading a dump. With ASE 12.5.3 it has worked very well, with ASE 15.0.2 we got the error.

I tested it with SQL Rapid but I think I'll get the error with isql also.

Only for my understandig: Do you agree with the problem? Because you're getting an error also.

"Did you find documentation somewhere stating that @fullname could be more than 30 characters?"
No, I didn't. The only thing I know is that on 12.5.x it works ( ok, fullname column is cropped, but the accout is
created ).

I checked the width of the fullname column for both version and it's 30 characters.

Are you able to test it with 12.5.x?

Heinz
Post by Mark A. Parsons
====================
2> go
---------------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.0.2/EBF 15963 ESD#6/P/NT (IX86)/Windows 2000/ase1502/2537/32-bit/OPT/Wed Oct 01
21:41:43 2008
1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
2> go
'these are more than 30 characters I think' is not a valid name.
(return status = 1)
===================
If you're not getting an error via isql ... what's your ASE version?
------------------------------------------
- sp_addlogin determines that the max length for the syslogins.fullname column is 30
- sp_addlogin makes a call to an undocumented version of valid_name() which in this case causes the generation of the
'Msg 17240' (ie, the input string is > 30 characters in length)
- syslogins.fullname is still defined as varchar(30) (at least in my ASE version)
bug in the documentation, eh
Post by Heinz Müller
Hi,
sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
In ASE 12.5 the account is created but the fullname column cropped after 30 characters.
In ASE 15.0.2 the account isn't created at all.
Anyone know if this a feature of 15.0.2? Any parameters I can set to get the 12.5.x behaviour?
THX!
Heinz
Mark A. Parsons
2009-02-20 19:40:11 UTC
Permalink
I don't have access to a 12.5.3 dataserver at the moment, but I did verify that the same sp_addlogin command succeeds
(w/ a truncated fullname) on a 12.5.4 dataserver.

--------------------

A quick glance at the source code for both versions of sp_addlogin show:

1 - ASE 12.5.x defines @fullname as varchar(30); ASE 15.0.x defines @fullname as varchar(255)

2 - ASE 12.5.x silently truncates 'long' fullnames at input parameter parsing time, ie, only the first 30 characters are
read into the @fullname input parameter (this is normal behaviour)

3 - ASE 12.5.x does no checking/validating of the @fullname value (and it wouldn't matter at this point since @fullname
could never be more than 30 characters in lenght anyway)

4 - ASE 15.0.x has added additional logic to check/validate the @fullname value, to include insuring you don't pass in a
value that's too long; rather odd, especially due to the mismatch between @fullname=varchar(255) and the following
limits ...

5 - ASE 15.0.x still has a limit on fullname length as 30 ... per valid_name(), and per syslogins.fullname's definition

-------------------

The error you're getting in ASE 15.0.x would appear to be 'valid' per the code in the sp_addlogin stored proc.

The fact that the ASE 15.0.x sp_addlogin stored proc allows @fullname to accept up to 255 characters, while valid_name()
and syslogins.fullname can't support such a large string, would appear to be a bug.

I'd suggest opening a CR with Sybase TechSupport ... and obviously (?) refrain from passing anything greater than 30
characters to sp_addlogin as the value for the @fullname input parameter (that, or rewrite sp_addlogin to define
@fullname=varchar(30)).
Post by Heinz Müller
Mark,
I'm not in my office now. Monday again!
We noticed the problem first with a special delivered stored procedure for user referencing
after loading a dump. With ASE 12.5.3 it has worked very well, with ASE 15.0.2 we got the error.
I tested it with SQL Rapid but I think I'll get the error with isql also.
Only for my understandig: Do you agree with the problem? Because you're getting an error also.
No, I didn't. The only thing I know is that on 12.5.x it works ( ok, fullname column is cropped, but the accout is
created ).
I checked the width of the fullname column for both version and it's 30 characters.
Are you able to test it with 12.5.x?
Heinz
Post by Mark A. Parsons
====================
2> go
---------------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.0.2/EBF 15963 ESD#6/P/NT (IX86)/Windows 2000/ase1502/2537/32-bit/OPT/Wed Oct 01
21:41:43 2008
1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
2> go
'these are more than 30 characters I think' is not a valid name.
(return status = 1)
===================
If you're not getting an error via isql ... what's your ASE version?
------------------------------------------
- sp_addlogin determines that the max length for the syslogins.fullname column is 30
- sp_addlogin makes a call to an undocumented version of valid_name() which in this case causes the generation of the
'Msg 17240' (ie, the input string is > 30 characters in length)
- syslogins.fullname is still defined as varchar(30) (at least in my ASE version)
bug in the documentation, eh
Post by Heinz Müller
Hi,
sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
In ASE 12.5 the account is created but the fullname column cropped after 30 characters.
In ASE 15.0.2 the account isn't created at all.
Anyone know if this a feature of 15.0.2? Any parameters I can set to get the 12.5.x behaviour?
THX!
Heinz
Heinz Müller
2009-02-20 19:18:04 UTC
Permalink
I asked a colleague to send me the informations:

1> select @@version
2> go

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Adaptive Server Enterprise/12.5.3/EBF 12869 ESD#4/P/Sun_svr4/OS 5.8/ase1253/1923/64-bit/FBO/Thu Sep 8 16:05:41 2005(1 row affected)1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"2> goPassword correctly set.Account unlocked.New login created.(return status = 0)1> select name, fullname from syslogins where name = "heinz"2> go name fullname ------------------------------ ------------------------------ heinz these are more than 30 charact(1 row affected)1>1> select @@version2> go --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Adaptive Server Enterprise/15.0.2/EBF 15679 ESD#5/P/Sun_svr4/OS 5.8/ase1502/2528/64-bit/FBO/Tue Jun 17 17:24:07 2008(1 row affected)1>1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"2> goMsg 17240, Level 16, State 1:Server 'PRIMEINNO', Procedure 'sp_addlogin', Line 238:'these are more than 30 characters I think' is not a valid name.(return status = 1)1>Heinz
Carl Kayser
2009-02-20 19:44:47 UTC
Permalink
Post by Mark A. Parsons
I'm gonna assume you issued this command via some GUI ... because when I
====================
2> go
---------------------------------------------------------------------------------------------------------------------------
Adaptive Server Enterprise/15.0.2/EBF 15963 ESD#6/P/NT (IX86)/Windows
2000/ase1502/2537/32-bit/OPT/Wed Oct 01 21:41:43 2008
1> sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
2> go
'these are more than 30 characters I think' is not a valid name.
(return status = 1)
===================
If you're not getting an error via isql ... what's your ASE version?
------------------------------------------
- sp_addlogin determines that the max length for the syslogins.fullname column is 30
- sp_addlogin makes a call to an undocumented version of valid_name()
which in this case causes the generation of the 'Msg 17240' (ie, the input
string is > 30 characters in length)
- syslogins.fullname is still defined as varchar(30) (at least in my ASE version)
improperly declared as varchar(255). Did you find documentation somewhere
obviously (?) there's a bug in the documentation, eh
Post by Heinz Müller
Hi,
I figured out a different behaviour if I create a login with more than 30
sp_addlogin heinz, password, null, null, "these are more than 30 characters I think"
In ASE 12.5 the account is created but the fullname column cropped after 30 characters.
In ASE 15.0.2 the account isn't created at all.
Anyone know if this a feature of 15.0.2? Any parameters I can set to get
the 12.5.x behaviour?
THX!
Heinz
Hmmmmm, per the 15.0 documentation master.dbo.syslogins.fullname is varchar
(30) so it looks like you can't put 255 Ibs. in a 30 Ib. bag. It looks like
the argument definition is incorrect. Also:

valid_name
Description Returns 0 if the specified string is not a valid identifier or a
number other than

0 if the string is a valid identifier, and can be up to 255 bytes in length.

Syntax valid_name(character_expression [, maximum_length])

Parameters character_expression

is a character-type column name, variable, or constant expression of char,

varchar, nchar or nvarchar type. Constant expressions must be enclosed in

quotation marks.

maximum_length

is an integer larger than 0 and less than or equal to 255. The default value
is

30. If the identifier length is larger than the second argument, valid_name

returns 0, and returns a value greater than zero if the identifier length is

invalid.

Examples Creates a procedure to verify that identifiers are valid:

create procedure chkname

@name varchar(30)

as

if valid_name(@name) = 0

print "name not valid"

Usage . valid_name, a system function, returns 0 if the character_
expression is not

a valid identifier (illegal characters, more than 30 bytes long, or a
reserved

word), or a number other than 0 if it is a valid identifier.

. Adaptive Server identifiers can be a maximum of 16384 bytes in length,

whether single-byte or multibyte characters are used. The first character of

an identifier must be either an alphabetic character, as defined in the

current character set, or the underscore (_) character. Temporary table

names, which begin with the pound sign (#), and local variable names,

which begin with the at sign (@), are exceptions to this rule. valid_name

returns 0 for identifiers that begin with the pound sign (#) and the at sign

(@).

. For general information about system functions, see "System functions"

on page 68.

Standards ANSI SQL - Compliance level: Transact-SQL extension.

Permissions Any user can execute valid_name.

See also System procedure sp_checkreswords
Mark A. Parsons
2009-02-20 20:30:34 UTC
Permalink
Post by Carl Kayser
Hmmmmm, per the 15.0 documentation master.dbo.syslogins.fullname is varchar
(30) so it looks like you can't put 255 Ibs. in a 30 Ib. bag. It looks like
Yep, already covered.
Post by Carl Kayser
valid_name
Description Returns 0 if the specified string is not a valid identifier or a
number other than
0 if the string is a valid identifier, and can be up to 255 bytes in length.
Syntax valid_name(character_expression [, maximum_length])
Thanks. I was going by a quick lookup in Rob's purple book - which doesn't show the 2nd parameter; I noticed that
sp_addlogin does make use of the second parameter by passing in the length of syslogins.fullname (ie, 30) as the second
parameter ... so anything in @fullname (defined as varchar(255)) that's longer than 30 characters will cause the error.
Rob V
2009-02-20 21:39:24 UTC
Permalink
Post by Mark A. Parsons
Post by Carl Kayser
Hmmmmm, per the 15.0 documentation master.dbo.syslogins.fullname is
varchar (30) so it looks like you can't put 255 Ibs. in a 30 Ib. bag. It
Yep, already covered.
Post by Carl Kayser
valid_name
Description Returns 0 if the specified string is not a valid identifier
or a number other than
0 if the string is a valid identifier, and can be up to 255 bytes in length.
Syntax valid_name(character_expression [, maximum_length])
Thanks. I was going by a quick lookup in Rob's purple book - which
doesn't show the 2nd parameter; I noticed that sp_addlogin does make use
of the second parameter by passing in the length of syslogins.fullname
varchar(255)) that's longer than 30 characters will cause the error.'
Yes... I missed that one :(
It will be in the next edition though.

Rob V.
Derek Asirvadem
2009-02-22 01:40:06 UTC
Permalink
Right.

Therefore what remains to be resolved:
- 15.0 does more checking than 12.5 and returns an error, which is correct
- 12.5.4 truncated and did not return an error. You might want this
but that level of service is obsolete; has been improved; and is no
longer available
- there is no suggestion by Sybase that 12.5. code will work in 15.0.
In fact, if you read the Migration Guides and WPs, they said exactly
the opposite [*]
- it is not bug, no TS case necessary
- if your calling code cannot handle the error (which it didn't
otherwise you would not have reported silent failure), change it to
truncate the column to char(30) before the call to sp_addlogin.

* Most of us are spending a lot of time changing our code in order to
[a] make the demanded changes and [b] use the new features; wait until
you hit the changed function names and the "order by" issues.
Personally, I am upset with the changed function names, but everything
else (inconsistencies/incompatibilities between 12.5 vs 15.0) are
ordinary requirements of moving to a new major release of vendor
software, where you want the higher levels of service and performance.
And if you don't, do not migrate (there are many sites using ancient
versions of ASE)
--
Cheers
Derek
Senior Sybase DBA / Information Architect
Copyright © 2008 Software Gems Pty Ltd
--
With the financial meltdown, consolidating many databases into one ASE
server and managing mixed load is a demand. Ask people who have been
doing it for years.
Loading...