I have a doubt regarding a constrained optimisation problem.

Suppose my original constrained minimisation problem is

$\underset{x}{min}f(g(x),x)\phantom{\rule{1em}{0ex}}\text{s.t.}\phantom{\rule{1em}{0ex}}g(x)=3$

I would like to know if this equivalent to solving the unconstrained minimisation problem

$\underset{x}{min}f(3,x)$

If not, when are these two problems equivalent?

Suppose my original constrained minimisation problem is

$\underset{x}{min}f(g(x),x)\phantom{\rule{1em}{0ex}}\text{s.t.}\phantom{\rule{1em}{0ex}}g(x)=3$

I would like to know if this equivalent to solving the unconstrained minimisation problem

$\underset{x}{min}f(3,x)$

If not, when are these two problems equivalent?