I did consider putting SYNONYM info into SYSTABLES with synonym target being present in SYSALIASES. That would have been a clean implementation. But, alias, I need to store schemaName of the target as a name, instead of as ID. Unless I overload 'javaClassName' column for schema name, it wouldn't be possible. So, no, I am not doing that already. ;-)  I know you might come up with a cleverer way to do this, that is why I posted the question first.

Well, I currently check if a table of same name is present before allowing a synonym to be created. Same the other way. Not good? :-\ 

Satheesh

Daniel John Debrunner wrote:
Satheesh Bandaram wrote:

  
I almost submitted a patch using option 1, like I said I would. I have
added a SynonymAliasInfo to hold target of a synonym, which is
schemaName.tableName. I think this schemaName needs to be stored as a
name, instead of an ID so that the synonym stays valid even after
droping and recreating the target schema.
    

That seems like correct behaviour.

  
Yes, the namespace for SYNONYM is the same for tables and views. You
can't create a synonym if a table of that name already exists.
    

An explanation of how this is enforced would be good, another approach
would be to introduce a new table type in SYSTABLES, and then the
uniqueness would be handled by the existing code. Maybe you are doing
that already. I guess I should wait for the patch. :-)

Dan.