# Is it legal to reuse aliases for other attributes?

**URL:** <https://forum.datomic.com/t/is-it-legal-to-reuse-aliases-for-other-attributes/1381>\
**Category:** Datomic Pro\
**Created:** [March 9, 2020, 6:08pm UTC](https://forum.datomic.com/t/is-it-legal-to-reuse-aliases-for-other-attributes/1381 "2020-03-09T18:08:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolayandr](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/nikolayandr/32/375_2.png) [@nikolayandr](https://forum.datomic.com/u/nikolayandr)\
**Post date:** [March 9, 2020, 6:08pm UTC](https://forum.datomic.com/t/is-it-legal-to-reuse-aliases-for-other-attributes/1381/1 "2020-03-09T18:08:47Z")

</div>

E.g there is an alias **:Comment/text** on **:Comment/text.v1** but I want to use **:Comment/text** for **:Comment/text.v2** now, my steps to test this case are the next:

1: Set alias on **:Comment/text.v1**

```
(d/transact
      connComment
[[:db/add :Comment/text.v1 :db/ident :Comment/text]
 ])

```

2: So, **:Comment/text** can be used for transacting and querying, everything is expected

Now, I want to use **:Comment/text** for **:Comment/text.v2** :

3: I believe the alias should be retracted from idents of previous attribute

```
 (d/transact
      connComment
[[:db/retract :Comment/text.v1 :db/ident :Comment/text]
 ])

```

So, the transaction is executed successfully,

4: But after executing the above transaction **:Comment/text** still can be used, okay, no problem, unsetting from old attribute and setting for new one can be executed within the same transaction

```
 (d/transact
      connComment 
[[:db/retract :Comment/text.v1 :db/ident :Comment/text] [:db/add :Comment/text.v2 :db/ident :Comment/text]
 ] )

```

Now **:Comment/text** points to **:Comment/text.v2**. What I’m wondering whether it is legal way to reuse aliases by other attributes

**P.S.** After retracting alias from attribute datomic UI does not work(attributes tree panel)

Stack trace in UI console:

```
java.lang.NullPointerException
	at clojure.core$namespace.invokeStatic(core.clj:1603)
	at clojure.core$namespace.invoke(core.clj:1597)
	at clojure.core$comp$fn__5807.invoke(core.clj:2569)
	at clojure.core$group_by$fn__8507.invoke(core.clj:7156)
	at clojure.core.protocols$naive_seq_reduce.invokeStatic(protocols.clj:62)
```

---

<div class="post-metadata">

**Author:** ![marshall](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/marshall/32/48_2.png) [@marshall](https://forum.datomic.com/u/marshall)\
**Post date:** [March 17, 2020, 2:57pm UTC](https://forum.datomic.com/t/is-it-legal-to-reuse-aliases-for-other-attributes/1381/2 "2020-03-17T14:57:53Z")

</div>

You can indeed reuse an ident alias. The docs covering this approach can be found here: [https://docs.datomic.com/on-prem/schema.html#renaming-an-identity](https://docs.datomic.com/on-prem/schema.html#renaming-an-identity)

However, I would point out that changing aliased identity is not generally recommended and I would suggest avoiding it if possible.
